Picture coding method and picture decoding method

ABSTRACT

The method includes the following units: a coefficient number detecting unit ( 109 ) for detecting the number of coefficients which has a value other than 0 for each block according to the generated coefficient, a coefficient number storing unit ( 110 ) for storing the number of coefficients detected, a coefficient number coding unit ( 111 ) for selecting a table for variable length coding based on the numbers of coefficients in the coded blocks located on the periphery of a current block to be coded with reference to the selected table for variable length coding so as to perform variable length coding for the number of coefficients.

TECHNICAL FIELD

The present invention relates to a picture coding method and a picturedecoding method for coding an image digitally so as to transfer or storeit.

BACKGROUND ART

A coding of moving pictures, in general, divides a picture into acertain size of blocks and performs intra picture prediction and interpicture prediction for each block. It then applies orthogonaltransformation, for example, discrete cosine transform or the like foreach block of the smallest unit of a division (i.e. 4×4 pixels) so as toperform coding using variable length coding based on run level codingfor coefficients showing spatial frequency components gained byorthogonal transformation.

The variable length coding assigns variable length code to values of thecoefficients contained in the block to which orthogonal transformationis applied (level) as well as to numbers consisting of a series of acoefficient 0 (run). In this case, a table which corresponds the valueswith variable length code is called a VLC table. Under the conventionalmethod, only one table is prepared as a VLC table respectively for intraprediction coding and inter prediction coding (reference to ISO/IEC14496-2:1999(E) Information technology—coding of audio-visual objectsPart 2: Visual (1999-12-01) P. 119 7.4.1 Variable length decoding).

Under the variable length coding method explained in the existingtechnique, only one table is prepared as a VLC table respectively forintra prediction coding and inter prediction coding. Therefore, itcontains a problem that coding efficiency differs greatly depending on aquality of a current picture to be coded.

In order to solve this problem, a method of preparing a plurality oftables so as to refer to them by switching between them according to thenumber of coefficients other than 0 contained in a current block towhich orthogonal transformation is applied is conceivable. For realizingthis, it is necessary to perform coding by applying variable lengthcoding for the numbers of the coefficients other than 0, however, thecoding method and the decoding method are not yet established.

DISCLOSURE OF INVENTION

The present invention has been devised in view of these circumstancesand it is an object of the present invention to suggest a picture codingmethod as well as a picture decoding method that realize coding of thenumber of coefficients other than 0 contained in the block to whichorthogonal transformation is applied with high efficiency regardless ofthe quality of the current picture.

In order to solve the problem as mentioned above, a picture codingmethod according to the present invention codes, on a block-to-blockbasis, an image by transforming the image into coefficients showingspatial frequency components and comprises: a predicting step forcalculating a predictive value of the number of coefficients other than0 contained in a current block to be coded based on the numbers ofcoefficients other than 0 contained in coded blocks located on aperiphery of the current block; a table selecting step for selectingtables for variable length coding based on the predictive valuecalculated in the predicting step; and a variable length coding step forperforming variable length coding for the number of the coefficientsother than 0 contained in the current block with reference to the tablesfor variable length coding selected in the table selecting step.

Thus, it realizes an improvement in coding efficiency since it ispossible to refer to optimal tables for variable length coding whencoding the number of the coefficients other than 0 contained in thecurrent block.

Also, in the predicting step, the predictive value is calculated usingan average value of the numbers of the coefficients other than 0contained in the coded blocks.

Also, the tables for variable length coding include at least one VLCtable. In the table selecting step, the VLC table is selected based onthe predictive value calculated in the predicting step and in thevariable length coding step, the number of the coefficients other than 0contained in the current block is transformed into a variable lengthcode with reference to the VLC table selected in the table selectingstep.

The tables for variable length coding include at least one code tableand one VLC table. In the table selecting step, a code table and a VLCtable are selected based on the predictive value calculated in thepredicting step and in the variable length coding step, the number ofthe coefficients other than 0 contained in the current block istransformed into a code number with reference to the code table selectedin the table selecting step and then the code number is transformed intoa variable length code with reference to the VLC table selected in thetable selecting step.

The picture coding method comprises a keeping step for keeping thenumbers of the coefficients other than 0 contained in the coded blocksneighboring an uncoded block at least until the uncoded block is coded.

In the predicting step, the predictive value of the number of thecoefficients other than 0 contained in the current block is calculatedbased on the numbers of the coefficients other than 0 contained in thecoded blocks located above and on the left of the current block.

In the predicting step, a value 0 is set as the predictive value when nocoded blocks are found above and on the left of the current block.

In the predicting step, an average value of the numbers of thecoefficients other than 0 contained in the coded blocks located aboveand on the left of the current block is calculated as the predictivevalue when the coded blocks are found above and on the left of thecurrent block.

In the predicting step, the number of the coefficients other than 0contained in the coded block on the left of the current block is set asthe predictive value when the coded block is found on the left but notabove the current block.

In the predicting step, the number of the coefficients other than 0contained in the coded block above the current block is set as thepredictive value when the coded block is found above but not on the leftof the current block.

In the predicting step, a value 0 is set as the predictive value whenupper and left boundaries of the current block are either a boundary ofpictures, each of which is a unit of the picture or a boundary ofslices, each of which is what the picture is divided into a plurality ofsections.

In the predicting step, an average value of the numbers of thecoefficients other than 0 contained in the coded blocks located aboveand on the left of the current block is set as the predictive value whenupper and left boundaries of the current block are neither a boundary ofpictures, each of which is a unit of the picture nor a boundary ofslices, each of which is what the picture is divided into a plurality ofsections.

In the predicting step, the number of the coefficients other than 0contained in the coded block on the left of the current block is set asthe predictive value when an upper boundary of the current block iseither a boundary of pictures, each of which is a unit of the picture ora boundary of slices, each of which is what the picture is divided intoa plurality of sections, and the left boundary is neither the boundaryof pictures nor the boundary of slices.

In the predicting step, the number of the coefficients other than 0contained in the coded block above the current block is set as thepredictive value when a left boundary of the current block is either aboundary of pictures, each of which is a unit of the picture or aboundary of slices, each of which is what the picture is divided into aplurality of sections, and an upper boundary is neither the boundary ofpictures nor the boundary of slices.

A picture decoding method according to the present invention decodes, ona block-to-block basis, an image that is coded by transforming the imageinto coefficients showing spatial frequency components and comprises:

a predicting step for calculating a predictive value of the number ofthe coefficients other than 0 contained in a current block to be decodedbased on numbers of coefficients other than 0 contained in decodedblocks located on a periphery of the current block;

a table selecting step for selecting tables for variable length decodingbased on the predictive value calculated in the predicting step; and

a variable length decoding step for performing variable length decodingfor the number of the coefficients other than 0 contained in the currentblock with reference to the tables for variable length decoding selectedin the table selecting step.

Thus, it realizes a correct decoding of a bit stream, in which thenumber of the coefficients other than 0 contained in the block is coded,referring to optimal tables for variable length decoding.

Also, in the predicting step, the predictive value is calculated usingan average value of the numbers of the coefficients other than 0contained in the decoded blocks.

Also, the tables for variable length decoding include at least one VLCtable. In the table selecting step, the VLC table is selected based onthe predictive value calculated in the predicting step, and in thevariable length decoding step, a variable length code showing the numberof coefficients other than 0 contained in the current block istransformed into said number of the coefficients other than 0 containedin the current block, with reference to the VLC table selected in thetable selecting step.

The tables for variable length decoding include at least one code tableand one VLC table. In the table selecting step, the code table and theVLC table are selected based on the predictive value calculated in thepredicting step, and in the variable length decoding step, a variablelength code showing the number of coefficients other than 0 contained inthe current block is transformed into a code number with reference tothe VLC table selected in the table selecting step, and then the codenumber is transformed into said number of the coefficients other than 0contained in the current block, with reference to the code tableselected by the table selecting step.

The picture decoding method comprises a keeping step for keeping thenumbers of the coefficients other than 0 contained in the decoded blocksneighboring an undecoded block at least until the undecoded block isdecoded.

In the predicting step, the predictive value of the number of thecoefficients other than 0 contained in the current block is calculatedbased on the numbers of the coefficients other than 0 contained in thedecoded blocks located above and on the left of the current block.

In the predicting step, a value 0 is set as the predictive value when nodecoded blocks are found above and on the left of the current block.

In the predicting step, an average value of the numbers of thecoefficients other than 0 contained in the decoded blocks located aboveand on the left of the current block is set as the predictive value whenthe decoded blocks are found above and on the left of the current block.

In the predicting step, the number of the coefficients other than 0contained in the decoded block on the left of the current block is setas the predictive value when the decoded block is found on the left butnot above.

In the predicting step, the number of the coefficients other than 0contained in the decoded block above the current block is set as thepredictive value when the decoded block is found above but not on theleft of the current block.

In the predicting step, a value 0 is set as the predictive value whenupper and left boundaries of the current block are either a boundary ofpictures, each of which is a unit of the picture or a boundary ofslices, each of which is what the picture is divided into a plurality ofsections.

In the predicting step, an average value of the numbers of thecoefficients other than 0 contained in the decoded blocks located aboveand on the left of the current block is set as the predictive value whenupper and left boundaries of the current block are neither a boundary ofpictures, each of which is a unit of the picture nor a boundary ofslices, each of which is what the picture is divided into a plurality ofsections.

In the predicting step, the number of the coefficients other than 0contained in the decoded block on the left of the current block is setas the predictive value when an upper boundary of the current block iseither a boundary of pictures, each of which is a unit of the picture ora boundary of slices, each of which is what the picture is divided intoa plurality of sections, and a left boundary of the block is neither theboundary of pictures nor the boundary of slices.

In the predicting step, the number of coefficients other than 0contained in the decoded block above the current block is set as thepredictive value when a left boundary of the current block is either theboundary of pictures, each of which is a unit of the picture or aboundary of slices, each of which is what the picture is divided into aplurality of sections, and an upper boundary of the block is neither theboundary of pictures nor the boundary of slices.

The present invention is realized not only as a picture coding methodand a picture decoding method, but also as a picture coding device and apicture decoding device including the characteristic steps contained inthese methods as means. It is realized also as a program which causes acomputer to execute these steps or as a bit stream created by thepicture coding method. Such a program can surely be distributed througha storage medium like CD-ROM and a transmission medium like Internet.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing a structure of an embodiment of apicture coding device using a picture coding method according to thepresent invention.

FIG. 2A is a pattern diagram showing a sketch of a processing order ofmacroblocks in each picture. FIG. 2B is a pattern diagram showingmacroblocks which belong to coded blocks used for reference in order toencode a number of coefficients of a current block to be coded.

FIG. 3A is a block diagram showing a structure of a coefficient numberencoder according to the first embodiment of the present invention. FIG.3B is a block diagram showing a structure of a transformational exampleof the coefficient number encoder.

FIG. 4A and FIG. 4B are pattern diagrams showing a physical position ofa current block to be coded and the coded blocks used for the reference.FIG. 4A presents a case of using three adjacent blocks whereas FIG. 4Bpresents a case of using two adjacent blocks.

FIG. 5 is a pattern diagram showing an example of a flow when the numberof coefficients is transformed into a bit stream with reference totables.

FIG. 6A and FIG. 6B are pattern diagrams showing reference blocks for acurrent macroblock to be coded. FIG. 6A presents a case of using threeadjacent blocks whereas FIG. 6B presents a case of using two adjacentblocks.

FIG. 7A, FIG. 7B and FIG. 7C are pattern diagrams showing an operationin which a coefficient number storing unit stores the numbers ofcoefficients. FIG. 7A presents a case where a processing proceeds to thenext macroblock whereas FIG. 7B presents a case where the processingfurther proceeds to the next macroblock. FIG. 7C presents a case wherethe current macroblock is located at the right edge of the picture andthe processing shifts to the next macroblock.

FIG. 8A, FIG. 8B and FIG. 8C are block diagrams showing a structure of atransformational example of a coefficient number encoder according tothe first embodiment of the present invention.

FIG. 8A presents a case of fixing a code table. FIG. 8B presents a caseof fixing a VLC table. The FIG. 8C presents a case of using only a VLCtable without using code tables.

FIG. 9 is a block diagram showing a structure of a transformationalexample of the coefficient number encoder according to the firstembodiment of the present invention.

FIG. 10A is a block diagram showing a structure of a coefficient numberencoder according to the second embodiment of the present invention.FIG. 10B is a block diagram showing a structure of a transformationalexample of the coefficient number encoder.

FIG. 11A and FIG. 11B are pattern diagrams for showing a position ofblocks targeted for statistics of the numbers of coefficients accordingto the second and the seventh embodiments of the present invention.

FIG. 12A is a block diagram showing a structure of a coefficient numberencoder according to the third embodiment of the present invention. FIG.12B is a block diagram showing a structure of a transformational exampleof the coefficient number encoder.

FIG. 13A is a block diagram showing a structure of a coefficient numberencoder according to the fourth embodiment of the present invention.FIG. 13B is a block diagram showing a structure of a transformationalexample of the coefficient number encoder.

FIG. 14 is a block diagram for showing a method of calculating anevaluation value obtained by the table switching according to the fourthand the ninth embodiments of the present invention.

FIG. 15 is a block diagram showing a structure of a picture codingdevice according to the fifth embodiment of the present invention.

FIG. 16 is a block diagram showing a structure of a coefficient numberencoder according to the fifth embodiment of the present invention.

FIG. 17 is a block diagram showing a structure of an embodiment of apicture decoding device using a picture decoding method according to thepresent invention.

FIG. 18A is a block diagram showing a structure of a coefficient numberdecoder according to the sixth embodiment of the present invention. FIG.18B is a block diagram showing a structure of a transformational exampleof the coefficient number decoder.

FIG. 19 is a pattern diagram showing an example of a flow when a bitstream of a number of coefficients is transformed into the number ofcoefficients with reference to tables.

FIG. 20A and FIG. 20B are block diagrams showing a structure of atransformational example of a coefficient number decoder according tothe sixth embodiment of the present invention. FIG. 20A presents a caseof fixing a code table. FIG. 20B presents a case of fixing a VLC table.FIG. 20C presents a case of using a VLC table without using code tables.

FIG. 21 is a block diagram showing a structure of a transformationalexample of a coefficient number decoder according to the sixthembodiment of the present invention.

FIG. 22A is a block diagram for explaining an operation of processingshowing a structure of a coefficient number decoder according to theseventh embodiment of the present invention. FIG. 22B is a block diagramshowing a structure of a transformational example of the coefficientnumber decoder.

FIG. 23A is a block diagram for explaining an operation of processingshowing a structure of a coefficient number decoder according to theeighth embodiment of the present invention. FIG. 23B is a block diagramshowing a structure of a transformational example of the coefficientnumber decoder.

FIG. 24A is a block diagram for explaining an operation of processingwhich shows a structure of the coefficient number decoder according tothe ninth embodiment of the present invention. FIG. 24B is a blockdiagram showing a structure of a transformational example of thecoefficient number decoder.

FIG. 25 is a block diagram for explaining an operation of processingwhich shows a structure of a coefficient number decoder according to thetenth embodiment of the present invention.

FIG. 26A and FIG. 26B are illustrations regarding a recording medium forstoring a program in order to realize a picture coding method as well asa picture decoding method of each embodiment in a computing system. FIG.26A is an explanatory diagram showing an example of a physical format ofa flexible disk which is a main body of a recording medium. FIG. 26B isan explanatory diagram showing a full appearance of the flexible disk, astructure at cross section and the flexible disk itself. FIG. 26C is anillustration showing a structure for recording and reproducing theprogram on the flexible disk FD.

FIG. 27 is a block diagram showing a whole structure of a contentproviding system which realizes a content delivery service.

FIG. 28 is a sketch showing an example of a cell phone.

FIG. 29 is a block diagram showing an internal structure of the cellphone.

FIG. 30 is a block diagram showing a whole system of a digitalbroadcasting system.

BEST MODE FOR CARRYING OUT THE INVENTION

The following describes the embodiments of the present invention withreference to the diagrams and equations.

First Embodiment

FIG. 1 is a block diagram showing a structure of an embodiment of apicture coding device using a picture coding method according to thepresent invention.

The picture coding device includes, as shown in FIG. 1, frame memories101 and 106, an orthogonal transforming unit 102, a quantizing unit 103,an inverse quantizing unit 104, an inverse orthogonal transforming unit105, an inter picture predicting unit 107, an intra picture predictingunit 108, a coefficient number detecting unit 109, a coefficient numberstoring unit 110, a coefficient number encoder 111, a coefficient valueencoder 112, a bit stream generating unit 113, switches 114 and 115, adifference calculating unit 116 and an addition calculating unit 117.

The frame memory 101 stores moving pictures inputted on apicture-to-picture basis in display order. The inter picture predictingunit 107 detects motion vectors which show a position predicted asoptimal in the searching area in the picture, using picture datareconstructed in a coding device as reference pictures so as to createpredictive picture data based on the motion vectors. The differencecalculating unit 116 calculates a difference between the input picturedata read out from the frame memory 101 and the predictive picture datainputted from the inter picture predicting unit 107 so as to createpredictive residual picture data.

The intra picture predicting unit 108 creates predictive picture datausing the picture data of the coded area in the current picture andcreates predictive residual picture data by calculating the differencebetween the created predictive picture data and the input picture data.

The orthogonal transforming unit 102 performs orthogonal transformationto the inputted predictive residual picture data. The quantizing unit103 performs a quantization to the orthogonal transformed data andcreates coefficients showing spatial frequency components which is anobject for variable length coding. The inverse quantizing unit 104performs inverse quantization to the coefficients created in theaforementioned processing. The inverse orthogonal transforming unit 105performs inverse orthogonal transformation to the inverse quantized dataand creates reconstructed predictive residual picture data. The additioncalculating unit 117 adds the reconstructed residual picture datainputted from the inverse orthogonal transforming unit 105 and thepredictive picture data inputted from the inter predicting unit 107 andcreates reconstructed picture data. The frame memory 106 stores thecreated reconstructed picture data.

The coefficient number detecting unit 109 detects the number ofcoefficients having a value other than 0 (hereafter simply refers tonumber of coefficients) from each block by examining the value of thecreated coefficient. The coefficient number storing unit 110 stores thenumbers of coefficients detected by the coefficient number detectingunit 109. The coefficient number encoder 111 refers to the values of thecoefficients in the block, that are already coded and stored in thecoefficient number storing unit 110 and performs coding for the numbersof the coefficients using a method to be mentioned later. Thecoefficient value encoder 112 performs variable length coding for thevalues of the coefficients themselves with reference to VLC tablesnecessary for variable length coding by switching between them using thenumbers of the coefficients detected by the coefficient number detectingunit 109. The bit stream generating unit 113 generates a bit stream byadding other information on the motion vectors or the like inputted fromthe inter picture prediction unit 107 to the numbers of the coefficientsand the values of the coefficients, which are coded.

Next, an explanation regarding an operation of a picture coding deviceconstructed as above follows.

The moving pictures targeted for coding are inputted to the frame memory101 on a picture-to-picture basis in display order and then reordered inthe order of coding. Each picture is divided into a block of, forinstance, 16 (horizontal)×16 (vertical) pixels called macroblock, andsubsequent processing take place using the unit of macroblock. FIG. 2Ais a pattern diagram showing a sketch of a processing order ofmacroblocks in each picture whereas FIG. 2B is a pattern diagram showingmacroblocks to which the coded blocks used for reference in order toencode the numbers of the coefficients in the current block belong. TheFIG. 2B shows a case where a macroblock MB13 is the current macroblock.

Coding of the macroblocks in each picture starts from upper left, one byone, to the right, as shown in the FIG. 2A, goes one step down when itcomes to the right edge and starts again from the left to the right. Themacroblock, which is read out from the frame memory 101, is firstlyinputted to the inter picture predicting unit 107 when a currentmacroblock to be coded is coded using inter picture prediction. Theinter picture predicting unit 107 uses reconstructed picture data of thecoded pictures stored in the frame memory 106 as reference pictures fordetecting motion vectors in each block [i.e. 4 (horizontal)×4(vertical)pixels] which is a further divided macroblock. The inter picturepredicting unit 107 outputs predictive picture data created by thedetected motion vectors to the difference calculating unit 116. Thedifference calculating unit 116 creates predictive residual picture databy measuring the difference between the predictive picture data and theinput picture data of the current macroblock.

On the contrary, for coding the target macroblock by means of intrapicture prediction, the macroblock which is read out from the framememory 101 is firstly inputted to the intra picture predicting unit 108.The intra picture predicting unit 108 performs intra picture predictionusing the information on the surrounding blocks and creates predictiveresidual picture data.

The thus created predictive residual picture data goes throughprocessing of orthogonal transformation at the orthogonal transformingunit 102, processing of a quantization at the quantizing unit 103 foreach block and then is transformed into the coefficients for whichvariable length coding is to be performed. These coefficients areinputted to the coefficient number detecting unit 109, to thecoefficient value encoder 112 and to the inverse quantizing unit 104.

The coefficient number detecting unit 109 detects the number ofcoefficients having a value other than 0 in each block. The numbers ofcoefficients detected here are stored in the coefficient number storingunit 110. The coefficient number encoder 111 refers to the values byreading out from the coefficient number storing unit 110 the numbers ofthe coefficients in the coded blocks and performs coding for the numberof the coefficients of the current block. Also, the coefficient valueencoder 112 performs coding of the values of the coefficients themselvesusing the numbers of the coefficients detected by the coefficient numberdetecting unit 109. Lastly, the bit stream generating unit 113 generatesa definitive bit stream by adding, to the bit stream, the numbers of thecoefficients and the values of the coefficients, which are coded,together with other information on the motion vectors or the like.

The coefficients inputted to the inverse quantizing unit 104 go throughthe processing of inverse quantization at the inverse quantizing unit104 as well as the processing of inverse orthogonal transformation atthe inverse orthogonal transforming unit 105, and then, are transformedinto reconstructed predictive residual picture data. Next, the additioncalculating unit 117 adds the reconstructed predictive residual picturedata and the predictive picture data inputted from the inter picturepredicting unit 107 so as to create reconstructed picture data andstores it in the frame memory 106.

Thus, a sequence of coding is explained above. As for variable lengthcoding processing of the numbers of coefficients performed by thecoefficient number encoder 111, the detail is explained with referenceto FIG. 3˜FIG. 9 as well as Chart 1˜Chart 7.

FIG. 3A is a block diagram showing in detail an internal structure ofthe coefficient number encoder 111.

Here, an example of using two tables of a code table and a VLC table inorder to perform variable length coding for the number of coefficientsis shown. The code table is a table for transforming the number ofcoefficients into a code number whereas the VLC table is a table fortransforming the code number gained by the code table into variablelength code.

The coefficient number encoder 111 includes, as shown in FIG. 3A, apredictive value calculating unit 201, a code table storing unit 202, acode table selecting unit 203, a VLC table selecting unit 204, a VLCtable storing unit 205 and a coefficient number encoder 206.

Firstly, the numbers of coefficients of coded blocks on the peripheryare inputted from the coefficient number storing unit 110 shown in theFIG. 1 to the predictive value calculating unit 201. The predictivevalue calculating unit 201 determines the predictive value bycalculating an average value of these values. A maximum value, a minimumvalue or a medium value may be used instead of the average value as amethod to determine the predictive value.

FIG. 4A is a pattern diagram showing a location relationship between acurrent block to be coded and the coded blocks to be used for thereference. Here, a block X is a current block whereas three blocks in aposition of blocks B, C and D are reference blocks. As for the threeblocks in the position of the blocks B, C and D, when blocks which areneither coded nor located outside the picture or outside the slice whichis a picture divided into a plurality of sections, occurs, a change ismade to the reference blocks as in Chart 1. CHART 1 B C D Referenceblock ◯ ◯ ◯ B, C, D ◯ X ◯ A, B, D X X ◯ D ◯ ◯ X B, C X X X None

As for signs in Chart 1, a sign ◯ signifies a coded block and a sign Xsignifies a block which can not be referred to since it is neither codednor located outside the picture or outside the slice. For example, whenonly a block C can not be referred to, it shows that the references areblocks A, B and D. Chart 1 shows a relation between a condition of thereference blocks and the block(s) which can be referred to, however, thepatterns are not limited to this. Also, if no reference blocks arefound, either a value 0 or other arbitrary value is given directly as apredictive value.

The code table selecting unit 203 selects a code table for an actual usefrom a plurality of code tables stored in the code table storing unit202 in accordance with a predictive value calculated by the predictivevalue calculating unit 201.

Chart 2 is an example of a code table in which numbers of coefficientscorrespond to code numbers prepared beforehand by the code table storingunit 202. CHART 2 Coefficient number value Code table 1 Code table 2Code table 3 Code table 4 0 0 4 8 8 1 1 2 7 7 2 2 0 5 6 3 3 1 4 5 4 4 32 4 5 5 5 0 3 6 6 6 1 2 7 7 7 3 1 8 8 8 6 0

According to this example, a code table 1, for example, assigns codenumbers which are identical to numbers of coefficients whereas a codetable 2 assigns the code numbers so that a value 2 of the coefficientnumber plays a central role. Four types of code tables are preparedhere; however, the numbers of types of tables and values of tables arenot limited to those used in Chart 2. Also, Chart 3 presents selectioncriteria for code tables based on a predictive value. CHART 3 Predictivevalue Reference table 0˜2 Code table 1 3˜5 Code table 2 6˜8 Code table 3 9˜16 Code table 4

According to this example, the code table selecting unit 203 selects acode table as follows: it refers to a code table 1 when the predictivevalue calculated by the predictive calculating unit 201 is no more than2 whereas it refers to a code table 2 when the predictive value is morethan or equal to 3 and less than or equal to 5. The way of assigningpredictive values and the items of reference tables are not limited tothose used in Chart 3.

The VLC table selecting unit 204 selects a VLC table for actual use froma plurality of VLC tables stored in the VLC table storing unit 205 inaccordance with the predictive value calculated by the predictivecalculating unit 201.

Chart 4 is an example of a VLC table in which code numbers prepared inadvance by the VLC table storing unit 205 correspond with variablelength codes. CHART 4 Code VLC VLC VLC VLC number table 1 table 2 table3 table 4 0 0 1 10 100 1 01 010 11 101 2 001 011 0100 110 3 0001 0010001012 111 4 00001 00101 0110 01000 5 000001 00110 0111 01001 6 000000100111 001000 01010 7 00000001 0001000 001001 01011 8 000000001 0001001001010 01100

According to this example, a VLC table 1, in comparison with a VLC table4, is designed with a tendency that an amount of bit increases if thecode number is large and decreases if the code number is small. It showsthat the VLC table 1 can perform variable length coding more efficientlywhen an apparition probability of the code number concentrates in thearea where the values are small while the VLC table 4 can perform moreefficiently when the apparition probability scatters to the area wherethe values are big. Four types of tables are prepared here; however, thenumbers of types of tables and the values of tables are not limited tothose used in Chart 4. Also, Chart 5 presents selection criteria for VLCtables based on a predictive value. CHART 5 Predictive value Referencetable 0˜1 VLC table 1 2˜3 VLC table 2 4˜6 VLC table 3  7˜16 VLC table 4

According to this example, the VLC table selecting unit 204 selects aVLC table as follows: it refers to a VLC table 1 when the predictivevalue calculated by the predictive value calculating unit 201 is no morethan 1 whereas it refers to a VLC table 2 when the predictive value ismore than or equal to 2 and less than or equal to 3. The way ofassigning predictive values and the items of reference tables are notlimited to those used in Chart 5.

The coefficient number encoder 206 refers to the code table and the VLCtable which are selected by the above processing and performs variablelength coding of the number of the coefficients in the inputted currentblock. The coefficient number encoder 206 firstly transforms the numberof coefficients into a code number using the code table and thentransforms it into a variable length code corresponded to the codenumber, using the VLC table. FIG. 5 is a pattern diagram showing anexample of coding when the predictive value calculated by the predictivecalculating unit 201 is “6” and the number of the coefficients in thecurrent block is “4”. A code table 3 shown in FIG. 5 is selected at thecode table selecting unit 203 using Chart 3 and Chart 2 according to thepredictive value “6” and also a VLC table 3 shown in FIG. 5 is selectedat the VLC table selecting unit 204 using Chart 5 and Chart 4. Thecoefficient number encoder 206 transforms the inputted number of thecoefficients “4” into a code number “2” according to the code table 3and furthermore creates a definitive bit stream “0100” according to theVLC table 3.

Next, as for a storing processing of number of coefficients performed bythe coefficient number storing unit 110, the detail is explained. FIG.6A is a pattern diagram showing reference blocks with respect to acurrent macroblock to be coded in the predictive value calculating unit201. Here, a black border containing the blocks coded as B1˜B16 showsthe current macroblock whereas a hatched section shows the referenceblocks with respect to the current macroblock. Also, the numbersassigned to the blocks indicate the order of coding in the macroblock.

The coefficient number storing unit 110, for example, at the time ofstarting the processing of the current macroblock shown in FIG. 6Astores the numbers of coefficients detected by the coefficient numberdetecting unit 109, at least for the reference blocks shown in FIG. 6Awhich are necessary for the current macroblock. Namely, the coefficientnumber storing unit 110 stores the numbers of coefficients detectedaccording to the blocks of the current macroblock (B1, B2, B3, . . . andB16) which are to be processed sequentially. For example, when thecurrent block is a block B6, the coefficient number storing unit 110stores the numbers of each coefficient of B1, B2, B3, B4 and B5 whichare already processed in addition to the reference blocks shown ashatched in FIG. 6A. Then, the coefficient number storing unit 110 storesthe number of coefficients of this block B6 when it is detected by thecoefficient number detecting unit 109. Thus, the coefficient numberstoring unit 110 stores the numbers of the coefficients detected fromthe blocks in the current macroblocks (B1, B2, B3, . . . and B16) whichare to be processed sequentially.

Then, for example, when the current macroblock is a macroblock MB11shown in FIG. 2, the coefficient number storing unit 110 at least storesthe numbers of the coefficients of the blocks in a bottom row and aright column (hatched blocks) of the macroblock MB11 as shown in FIG. 7Awhen the processing of the macroblock MB11 terminates and proceeds tothe next macroblock MB12. Next, when the processing of the macroblockMB12 terminates and the processing proceeds to the next macroblock MB13,the coefficient number storing unit 110 stores at least the numbers ofthe coefficients for the blocks located in the bottom row and in theright column of the macroblock MB12 in the same way as well as thenumbers of coefficients of the blocks in the bottom row of themacroblock MB11 (hatched blocks) as shown in FIG. 7B.

For example, when the current macroblock is located in the right edge ofthe picture as the macroblock MB9 shown in FIG. 2B, the coefficientnumber storing unit 110 stores at least the numbers of coefficients ofthe blocks in the bottom row of the macroblock MB9 (hatched blocks) asshown in FIG. 7B when the processing of the macroblock MB9 terminatesand the processing proceeds to the next macroblock MB10.

When the current macroblock is located in the bottom edge of the pictureas MBm shown in FIG. 2B, the coefficient number storing unit 110 storesat least the numbers of the coefficients of the blocks in the rightcolumn of the macroblock MBm as shown in FIG. 7C when the processing ofthe macroblock MBm terminates and the processing proceeds to the nextmacroblock MBn.

The coefficient number storing unit 110 thus stores the numbers ofcoefficients for the blocks to be referred to. It is possible to delete,in an arbitrary timing, the information on the number of coefficients ofthe blocks other than those to be stored in the above explanation ifthey are no longer used for reference. For example, it is possible todelete when processing proceeds to the next macroblock as well as whileprocessing the macroblock. Also, the numbers of coefficients in theblocks which are no longer used for reference do not always needprocessing of deleting. For instance, the coefficient number storingunit 110 may identify the numbers of coefficients in the blocks whichare not referred to any longer as unnecessary and may overwrite to themif necessary.

It is explained above that it is possible to refer to the numbers of thecoefficients of the coded blocks by storing them in the coefficientnumber storing unit 110. A system for calculating the number ofcoefficients, however, may be used, if necessary, by storing not thevalues of the number of the coefficients themselves but, for instance,the values of the coefficients in the blocks, which are transformed intospatial frequency components.

In the present embodiment, it is possible, as mentioned above, tocalculate a predictive value using the numbers of the coefficients inthe coded adjacent blocks so as to perform coding of the number ofcoefficients efficiently even to the pictures whose apparitionprobability of the coefficients is not even by referring to the codetable and the VLC table adaptively according to the predictive value.

Also, it can, as described above, correspond to a fluctuation of aposition where the apparition probability of the number of coefficientsis the highest with reference to the code table by switching themaccording to the predictive value. It can also correspond to the size ofthe dispersion of the apparition probability of the number ofcoefficients by switching the VLC tables for reference according to thepredictive value. Consequently, it is possible to perform effectivelycoding of the number of coefficients.

It is also possible to use only two blocks located in the position ofblocks B and D for a current block X to be coded as shown in FIG. 4B instead of using three neighboring blocks as reference blocks as shown inFIG. 4A at the predictive value calculating unit 201. A change is madeconcerning reference blocks as in Chart 6 when it happens that either oftwo blocks in the position of the blocks B and D is neither coded norlocated outside the picture nor outside the slice. CHART 6 B D Referenceblock ◯ ◯ B, D X ◯ D ◯ X B X X None

As for signs in Chart 6, a sign ◯ signifies a coded block and a sign Xsignifies a block which can not be referred to since it is neither codednor located outside the picture nor outside the slice as in Chart 1.Chart 6 shows a relation between conditions of the reference blocks andthe block(s) which can be referred to, however, the patterns are notlimited to this. If no reference blocks are found, either a value 0 orother arbitrary value can be given directly as a predictive value. Inthis case, the coefficient number storing unit 110 may only store thenumbers of coefficients detected at the coefficient number detectingunit 109, at least for the reference blocks shown in FIG. 6B, which arenecessary for the current macroblock.

It is also possible, as a method to calculate a predictive value in thepredictive value calculating unit 201, for example, to select an optimalmethod according to each sequence, each GOP, each picture or each slicerather than to fix the method to use either of an average value, amaximum value, a minimum value or a medium value. The code foridentifying the calculating method then selected is added at a headersection of the sequence, the GOP, the picture or the slice. The slice isa picture divided into a plurality of sections. A section of one columnin a transverse direction sectioned on a macroblock-to-macroblock basisis an example of this.

Also, it is possible to select, for example, either of an average value,a maximum value, a minimum value or a medium value according to theaverage value of the number of the coefficients in the coded referenceblocks. Chart 7 shows its selection criteria. CHART 7 Average valuePredictive value calculation method 0˜4 Minimum value 5˜8 Average value 9˜16 Maximum value

According to this example, a minimum value of the numbers of thecoefficients of more than one reference blocks is applied as apredictive value when, for example, an average value is less than orequal to 4 and an average value is applied as a predictive value whenthe average value is more than or equal to 5 and less than or equal to8. The positive effects of improvement in coding efficiency can beobtained in both cases: by selecting a maximum value since a probabilitythat greater number of coefficients appears becomes higher in the blocksin which the quantization step is small and the movements arecomplicated; and by selecting a minimum value since a probability thatsmaller number of coefficients appears becomes higher in the blocks inwhich the quantization step is inversely big and the movement is simple.The way of assigning the average value or the items indicated aspredictive value calculating methods is not limited to those indicatedin Chart 7.

The coefficient number encoder 111 in the present embodiment performsvariable length coding for the value of the number of coefficientsitself. The difference calculating unit 207 may, however, calculate adifference value between the predictive value calculated at thepredictive value calculating unit 201 and the value of number ofcoefficients which is inputted so as to perform coding for the gainedvalue with the same processing as described in the above embodiment. Thepositive effects can be obtained for the improvement in codingefficiency for a picture in which a change in the number of coefficientsamong the surrounding blocks becomes smaller when changes in luminanceand in chrominance are monotonous across the screen.

Also, the coefficient number encoder 111 performs coding by switchingboth the code table and the VLC table according to the predictive valuebased on the number of coefficients in the neighboring blocks; however,these tables may not be switched but fixed. This can be realized byusing only a storing unit which has either one certain type of codetables or one certain type of VLC tables in stead of using tableselecting units. FIG. 8A is a block diagram showing a structure of thecoefficient number encoder 111 for performing variable length coding ofthe number of coefficients by fixing only a code table. Also, FIG. 8B isa block diagram showing a structure of the coefficient number encoder111 for performing variable length coding of the number of coefficientsby fixing only a VLC table. In case of fixing only a code table, thecoefficient number encoder 111 as shown in FIG. 8A includes a code tablestoring unit 301 in stead of the code table storing unit 202 and thecode table selecting unit 203 shown in FIG. 3A. The code table storingunit 301 has one type of code table. Then, the coefficient numberencoder 206 first transforms the number of coefficients into a codenumber using a code table stored in the code table storing unit 301 thentransforms the code number to variable length code using a VLC tableselected by the VLC table selecting unit 204.

On the other hand, the coefficient number encoder 111 as shown in FIG.8B includes a VLC table storing unit 302 in stead of the VLC tablestoring unit 205 and the VLC table selecting unit 204 shown in FIG. 3A.The VLC table storing unit 302 has one type of VLC table. Then, thecoefficient number encoder 206 firstly transforms the number ofcoefficients into a code number using the code table selected by thecode table selecting unit 203 then transforms the code number into avariable length code using the VLC table stored in the VLC table storingunit 302.

Thus by fixing either the code table or the VLC table in stead ofswitching between them, the throughput for switching tables can bereduced or an amount of memory for storing a plurality of tables can bereduced although the effects of coding efficiency decreases more orless.

Also, the coefficient number encoder 111 may perform variable lengthcoding by switching only the VLC tables according to the predictivevalue based on the numbers of coefficients in the neighboring blockswithout using code tables. FIG. 8C is a block diagram showing astructure of the coefficient number encoder 111 for performing variablelength coding of the number of coefficients using only the VLC tableswithout code tables. In this case, as shown in FIG. 8C, the coefficientnumber encoder 111 includes neither the code table storing unit 202 northe code table selecting unit 203. The coefficient number encoder 111selects a VLC table for actual use from a plurality of VLC tables storedin the VLC table storing unit 304. Then, the coefficient number encoder206 directly transforms the number of coefficients into variable lengthcode without transforming it into the code number as shown above. Inthis case, in the examples of VLC tables shown in Chart 4, the partshown as code numbers is replaced by values of number of coefficients.

Also, the case in which the coefficient number encoder 111 performsvariable length coding using a difference value between a predictivevalue and a value of number of coefficients instead of a value of numberof coefficients can be handled in the same way. FIG. 9 is a blockdiagram showing, as an example of it, a structure of the coefficientnumber encoder 111 for performing variable length coding for adifference value between the predictive value and the number ofcoefficients by fixing both a code table and a VLC table. In this case,the coefficient number encoder 111 as in FIG. 9 includes a code tablestoring unit 301 in stead of the code table storing unit 202 and thecode table selecting unit 203 shown in FIG. 3A as well as a VLC tablestoring unit 302 in stead of the VLC table storing unit 205 and the VLCtable selecting unit 204. The code table storing unit 301 has one typeof code tables whereas the code VLC table storing unit 302 has one typeof VLC tables. Then, the coefficient number encoder 206 firstlytransforms the difference value between the number of coefficients andthe predictive value into a code number using the code table stored inthe code table storing unit 301 then transforms the code number into avariable length code using the VLC table stored in the VLC table storingunit 302.

Second Embodiment

The structure of the picture coding device and the outline of the codingprocessing according to the present embodiment are totally the same asthose described in the first embodiment excepting the coefficient numberencoder 111 shown in FIG. 1. Here, regarding variable length codingprocessing of the number of coefficients performed by the coefficientnumber encoder 111 in the second embodiment, the detail is explainedusing FIGS. 10 and 11.

FIG. 10A is a block diagram showing in detail an internal structure ofthe coefficient number encoder 111.

As shown in FIG. 10A, the coefficient number encoder 111 includes a codetable generating unit 701 in stead of the code table storing unit 202and the code table selecting unit 203 shown in FIG. 3A. The numbers ofcoefficients in the coded blocks are inputted to the code tablegenerating unit 701 from the coefficient number storing unit 110. Thecode table generating unit 701 counts the number of the coded blockshaving the same number of coefficients as the value of the number ofcoefficients at each of the values and creates code tables by assigningcode numbers in descending order starting from a coefficient numberwhich recorded the highest frequency based on the statistic. FIG. 11A isa pattern diagram presenting a position of the coded blocks targeted forstatistic. Here, a P1, a P3 and a P4 are pictures in which inter pictureprediction coding is performed whereas an I2 is a picture in which intrapicture prediction coding is performed. Supposing that a current blockbelongs to the P3, all the blocks, which are coded using the same methodas used for the current block, contained in the P1, which is a pictureimmediately preceding the current picture, are targeted for statistics.The case in which the blocks equivalents of one picture including thecoded blocks in the current picture are targeted for statistics as inFIG. 11B can be handled in the same way. Also, a table for the initialcondition in ascending order starting from the number 0 shall be used asa code table when the coded blocks equivalent to one picture which canbe targeted for statistic do not exist. Here, the blocks equivalent toone picture are targeted for statistics, however, the case in which thenumber of blocks other than this is used as a parameter can be handledin the same way. In case of applying a referring method as shown in FIG.11A so as to generate a code table, the table may be generated only oncewhen encoding of the current picture is started.

Meanwhile, the numbers of coefficients in the coded blocks situated onthe periphery are inputted to the predictive value calculating unit 201.The predictive value calculating unit 201 determines the predictivevalue by calculating an average value based on these values as describedin the first embodiment. A maximum value, a minimum value or a mediumvalue may be used in stead of the average value as a method to determinethe predictive value. The coded blocks then used as the reference, aredetermined according to Chart 1 using three blocks in the position ofthe blocks B, C and D for the current block X shown in FIG. 4A in thefirst embodiment. Chart 1 shows a relation between conditions of thereference blocks and the block(s) which can be referred to, however, thepatterns are not limited to this. Either a value 0 or other arbitraryvalue is given directly as a predictive value when no reference blocksare found.

The predictive value calculated by the predictive value calculating unit201 is used only at the VLC table selecting unit 204. The VLC tableselecting unit 204 selects, as in the first embodiment, according tothis predictive value, a VLC table for coding the number of coefficientsfrom a plurality of VLC tables prepared in the VLC table storing unit205 in advance as shown in Chart 4 in accordance with the selectioncriteria shown in Chart 5.

The coefficient number encoder 206 refers to the code table created bythe code table generating unit 701 and the VLC table selected by the VLCtable selecting unit 204 and then performs variable length coding of thenumber of the coefficients in the current block targeted for codingwhich is inputted in the same way as described in the first embodiment.

Thus, in the present embodiment, a code table is created by takingstatistics of the numbers of the coefficients in the coded blocks,furthermore, a VLC table is determined according to the predictive valuecalculated from the number of the coefficients in the coded blocks, andby referring to both of the tables, it is possible to perform coding ofthe number of coefficients efficiently even for a picture whoseapparition frequency of coefficients is uneven.

As in the first embodiment, it is also possible to determine the codedblocks used for reference at the predictive value calculating unit 201as in the first embodiment according to Chart 6 using only two blockslocated in the position of the blocks B and D for the current block Xshown in FIG. 4B in stead of using three neighboring blocks as shown inFIG. 4A. Chart 6 shows a relation between conditions of the referenceblocks and the block(s) which can be referred to, however, the patternsare not limited to this. Either a value 0 or other arbitrary value isgiven directly as a predictive value when no reference blocks are found.

As in the first embodiment, it is also possible to select, for example,either of an average value, a maximum value, a minimum value or a mediumvalue according to an average value of the numbers of the coefficientsin the coded reference blocks as a method to calculate a predictivevalue in the predictive value calculating unit 201 as in the firstembodiment. Chart 7 shows the selection criteria, however a way ofassigning the average value and items indicated as predictive valuecalculating methods are not limited to this.

In the present embodiment, the coefficient number encoder 111 performsvariable length coding for the value of the number of coefficientsitself. However, as in the first embodiment, it is possible, as shown inFIG. 10, that a difference value between the predictive value calculatedby the predictive value calculating unit 201 and the inputted value ofthe number of coefficients is calculated by the subtractor 207 andvariable length coding is performed for the gained value by the sameprocessing as described above.

Also, in the present embodiment, the coefficient number encoder 111performs variable length coding by switching the VLC tables according tothe predictive value based on the numbers of coefficients in theneighboring blocks. It is, however, possible to fix the table ratherthan to switch the VLC tables as in the first embodiment. In this case,this is realized by using only a VLC table storing unit which has onecertain type of VLC tables in stead of using the VLC table selectingunit.

Third Embodiment

The structure of the picture coding device and the outline of the codingprocessing according to the present embodiment are totally the same asthose described in the first embodiment, excepting the coefficientnumber encoder 111 shown in FIG. 1. Here, regarding variable lengthcoding processing of the number of coefficients performed at thecoefficient number encoder 111 in the third embodiment, the detail isexplained using FIGS. 12A and 12B as well as Charts 8 and 9.

FIG. 12A is a block diagram showing in detail an internal structure ofthe coefficient number encoder 111.

As shown in FIG. 12A, the coefficient number encoder 111 does notinclude the predictive value calculating unit 201 shown in FIG. 3A. Acode table selecting unit 901 and a VLC table selecting unit 902therefore select a table for actual use differently from the firstembodiment by using directly the numbers of the coefficients in thecoded blocks, without using a predictive value. As for the coded blocksthen used for the reference as shown in FIG. 4B, only two blocks in theposition of the block B (above) and the block D (left) for the currentblock X are used. However, when the blocks located above and on the leftare neither coded nor situated outside the picture nor outside theslice, either a value 0 or other arbitrary value can be substituted.

Chart 8 shows a method of selecting a code table in the code tableselecting unit 901. CHART 8 Coefficient number (above) 0˜5 6˜16Coefficient 0˜5 Code table 1 Code table 2 number  6˜16 Code table 3 Codetable 4 (left)

The code table selecting unit 901 classifies into two groups therespective number of coefficients in the blocks situated above and onthe left of the current block as shown in Chart 8 according to the valueand selects a table using a combination of the four thus formed. Forexample, a code table 2 is selected when the number of the coefficientsin the left block is 3 and the number of the coefficients in the aboveblock is 8. The method to classify the number of the coefficients in theupper and the left blocks and the way to assign code tables are notlimited to those used in Chart 8.

Chart 9 shows a method of selecting a VLC table at the VLC tableselecting unit 902. CHART 9 Coefficient number (above) 0˜5 6˜16Coefficient 0˜5 VLC table 1 VLC table 2 number  6˜16 VLC table 3 VLCtable 4 (left)

The VLC table selecting unit 902 selects a VLC table for actualreference using the selection method as shown in Chart 9 as in the caseof code table selecting unit 901.

The coefficient number encoder 206 refers to the code table selected bythe code table selecting unit 901 and the VLC table selected by the VLCtable selecting unit 902 so as to perform variable length coding for thenumber of coefficients in the current block which is inputted in thesame way as in the first embodiment.

Thus, in the present embodiment, by classifying the numbers ofcoefficients in the coded blocks located above and on the left of thecurrent block into “n” group(s) according to the value with reference tothe code table and the VLC table according to the combination of N×Nways then formed and by switching between them adaptively, it ispossible to perform efficiently the coding of the number of coefficientsfor the picture whose apparition frequency of coefficients is uneven.

In the present embodiment, the coefficient number encoder 111 performsvariable length coding for the value of the number of coefficientsitself. The difference calculating unit 207 may, however, calculate adifference value between the predictive value calculated at thepredictive value calculating unit 201 as shown in FIG. 12B as in thefirst embodiment and a value of the number of coefficients inputted soas to perform variable length coding.

Also, in the present embodiment, the coefficient number encoder 111performs variable length coding by switching both the VLC table and thecode table according to the numbers of the coefficients in theneighboring blocks. It is, however, possible to fix either of thesetables rather than to switch them as in the first embodiment. In thiscase, variable length coding is realized by using a storing unit whichhas either one certain type of code tables or one certain type of VLCtables in stead of using table selecting units. Furthermore, it is alsopossible to perform variable length coding by switching only the VLCtables according to the numbers of the coefficients in the neighboringblocks without using code tables, as in the first embodiment.

Fourth Embodiment

The structure of the picture coding device and the outline of the codingprocessing according to the present embodiment are totally the same asthose described in the first embodiment, excepting the coefficientnumber encoder 111 shown in FIG. 1. Here, regarding variable lengthcoding processing of the number of coefficients performed by thecoefficient number encoder 111 in the fourth embodiment, the detail isexplained using FIGS. 13 and 14.

FIG. 13A is a block diagram showing in detail an internal structure ofthe coefficient number encoder 111.

The coefficient number encoder 111 as shown in FIG. 13A includes a tableselecting unit 1001 in stead of the predictive value calculating unit201, the code table selecting unit 203 and the VLC table selecting unit204 shown in FIG. 3A. The table selecting unit 1001 uses directly thenumber of coefficients in the coded blocks without using a predictivevalue so as to select tables for actual use by evaluating both a codetable and a VLC table at the same time, which is different from thefirst embodiment. As for the coded blocks then used for the reference,the three blocks in the position of the blocks B, C and D for thecurrent block X are used as in FIG. 4A. However, when the blocks locatedas such are neither coded nor situated outside the picture nor outsidethe slice, either a value 0 or other arbitrary value can be substituted.

The table selecting unit 1001 calculates a sum of a length of a bitstream which is created as a result of coding the numbers of thecoefficients in the reference blocks using both the code table and theVLC table at the same time and determines it as an evaluation value.FIG. 14 is a pattern diagram showing a method to perform coding for thenumbers of coefficients in the three reference blocks using the codetables and the VLC tables and calculate the sum of the length of thegained bit stream so as to determine it as the estimation value. Then,the table selecting unit 1001 performs this processing to all thecombinations of the code tables and the VLC tables stored in the codetable storing unit 202 as well as the VLC table storing unit 205 andselects a combination of a code table and a VLC table in which thegained evaluation value is the smallest.

The coefficient number encoder 206 refers to the code table and the VLCtable selected by the table selecting unit 1001 and performs variablelength coding of the number of the coefficients in the current blockwhich is inputted in the same way as described in the first embodiment.

In the present embodiment as shown above, it is possible to performcoding for the numbers of the coefficients in the neighboring blockswhich are coded using the code table and the VLC table and determine thesum of the length of the bit stream at that time as an estimation valueso as to perform efficiently the coding of the number of coefficientseven for the picture whose apparition frequency of coefficients isuneven.

As for the coded blocks then used for the reference, the case in whichonly two blocks in the position of blocks B and D in stead of usingthree blocks in the position of blocks B, C and D for the current blockX as shown in FIG. 4A are used can be treated in the same way. In thisregard, when the blocks located above and on the left are neither codednor situated outside the picture nor outside the slice, either a value 0or other arbitrary value can be substituted.

In the present embodiment, the coefficient number encoder 111 performsvariable length coding for the value of the number of coefficientsitself. However, as in the first embodiment, it is possible, as shown inFIG. 13, that a difference value between the predictive value calculatedby the predictive value calculating unit 201 and the inputted value ofthe number of coefficients is calculated by the difference valuecalculating unit 207 and variable length coding is performed for thegained value by the same processing as described in the above-mentionedembodiments.

Also, in the present embodiment, the code table and the VLC table are tobe switched in the coefficient number encoder 111, however, it ispossible to fix either of them rather than to switch between them.

Fifth Embodiment

FIG. 15 is a block diagram showing a structure of a picture codingdevice in the fifth embodiment using a picture coding method accordingto the present invention. A sequence of coding processing is totally thesame as the first embodiment. The difference, however, is that thepresent embodiment does not use the coefficient number storing unit 110but employs inter picture prediction mode in case of inter pictureprediction coding and intra picture prediction mode in case of intrapicture prediction coding as referring information at a coefficientnumber encoder 1201 instead of using the number of the coefficients inthe coded blocks as in the first embodiment.

Here, regarding an explanation of variable length coding processing atthe coefficient number encoder 1201 shown in FIG. 15, the detail isexplained using FIG. 16, Chart 10 and Chart 11.

FIG. 16 is a block diagram showing in detail an internal structure ofthe coefficient number encoder 1201.

As shown in FIG. 16, the coefficient number encoder 1201 does notinclude the predictive value calculating unit 201 shown in Chart 3A. Aninter picture prediction mode is inputted from an inter picturepredicting unit 107 and an intra picture prediction mode is inputtedfrom an intra picture predicting unit 108 to a code table selecting unit1301 and a VLC table selecting unit 1302. Consequently, the code tableselecting 1301 selects a table based on the mode: the inter pictureprediction mode for inter picture prediction and the intra pictureprediction mode for intra picture prediction. Chart 10 shows a selectionmethod for code tables at the code table selecting unit 1301. CHART 10Inter picture Reference table prediction mode Intra picture predictionmode Code table 1 16 × 16, 16 × 8, 8 × 16 Plane prediction Code table 28 × 8 Oblique prediction Code table 3 8 × 4, 4 × 8 Oblique predictionCode table 4 4 × 4 Vertical and horizontal prediction

For example, in case where the current picture is coded using interpicture prediction, a code table 2 is selected accordingly for variablelength coding of the number of coefficients when a prediction of thecurrent block sized 8×8 is selected. The items are not limited to thoseused in Chart 10. Chart 11 shows a selecting method at the VLC tableselecting unit 1302. CHART 11 Inter picture Reference table predictionmode Intra picture prediction mode VLC table 1 16 × 16, 16 × 8, 8 × 16Plane prediction VLC table 2 8 × 8 Oblique prediction VLC table 3 8 × 4,4 × 8 Oblique prediction VLC table 4 4 × 4 Vertical and horizontalprediction

The VLC table selecting unit 1302 selects a VLC table for actualreference using a selection method shown in Chart 11 as in the case ofthe code table selecting unit 1301.

The coefficient number encoder 206 refers to the code table selected bythe code table selecting unit 1301 and a VLC table selected by the VLCtable selecting unit 1302 and performs variable length coding for thenumbers of the coefficients in the current block which is inputted inthe same way as in the first embodiment.

The present embodiment as shown above has shown a coding method whichrealizes efficient coding of the number of coefficients even for thepicture whose apparition frequency of coefficients is uneven, withreference to the code table and the VLC table by switching between themadaptively according to the mode: inter picture prediction mode forinter picture prediction coding and intra picture prediction mode forintra picture prediction coding.

In the present embodiment, the coefficient number encoder 1201 performsvariable length coding for the value of the number of coefficientsitself as in the first embodiment. However, it is possible, as in thefirst embodiment, to determine a predictive value using the numbers ofthe coefficients in the neighboring blocks which are coded as in thefirst embodiment and obtain a difference value between this predictivevalue and the inputted value of the number of coefficients so as toperform variable length coding for the gained value in the sameprocessing as in the above-mentioned embodiments.

Also, in the present embodiment the coefficient number encoder 1201performs variable length coding by switching both the code table and theVLC table. It is, however, possible to fix either of them rather thanswitching either or both of them. In this case, this is realized bypreparing only a storing unit which has one certain type of code tablesor one certain type of VLC tables in stead of using table selectingunits.

Sixth Embodiment

FIG. 17 is a block diagram showing a structure of an embodiment of apicture decoding device using a picture decoding method according to thepresent invention. The bit stream created by the picture coding deviceaccording to the first embodiment shall be inputted here.

The picture decoding device includes a bit stream analyzing unit 1401, acoefficient number storing unit 1402, a coefficient number decoder 1403,a coefficient value decoder 1404, an inverse quantizing unit 1405, aninverse orthogonal transforming unit 1406, a frame memory 1407, an interpicture prediction decoder 1408, an intra picture prediction decoder1409 and a switch 1410.

The bit stream analyzing unit 1401 extracts from the inputted bit streamvarious types of information such as a coding mode, motion vectors usedfor coding, a bit stream of the number of coefficients (the number ofcoefficients showing a spatial frequency component which has a valueother than 0 for each block) and various types of information on the bitstream of the value of the coefficients. The coefficient number storingunit 1402 stores the numbers of the coefficients of the decoded blocks.The coefficient number decoder 1403 decodes the bit stream of thenumbers of coefficients by referring to the numbers of the coefficientsin the decoded blocks.

The coefficient value decoder 1404 decodes the bit stream of the valueof the coefficients using the numbers of coefficients decoded by thecoefficient number decoder 1403. The inverse quantizing unit 1405performs inverse quantization to the decoded coefficients. The inverseorthogonal transforming unit 1406 performs inverse orthogonaltransformation to the data inversely quantized and transforms it topredictive residual picture data.

The inter picture prediction decoder 1408 creates motion compensationpicture data based on the motion vectors extracted by the bit streamanalyzing unit 1401 as well as decoded pictures or the like when acurrent macroblock to be decoded is coded with inter picture prediction.An addition calculating unit 1411 adds the predictive residual picturedata inputted from the inverse orthogonal transforming unit 1406 and themotion compensation picture data inputted from the inter pictureprediction decoder 1408 so as to create decoded picture data. The framememory 1407 stores the created decoded picture data.

The intra picture prediction decoder 1409 performs intra pictureprediction using information on the adjacent decoded blocks so as tocreate decoded picture data when the current macroblock is coded withintra picture prediction.

Next, an explanation of an operation of a picture decoding device asconstructed above follows.

As a start, a bit stream is inputted to the bit stream analyzing unit1401. The bit stream analyzing unit 1401 extracts from the inputted bitstream various types of information on motion vectors, a bit stream ofthe number of coefficients and a bit stream of the value of thecoefficients and so on. Then, the bit stream analyzing unit 1401 outputsrespectively as follows: the motion vectors to the inter pictureprediction decoding unit 1408, the bit stream of the number ofcoefficients to the coefficient number decoder 1403 and the bit streamof the value of the coefficients to the coefficient value decoder 1404.

The coefficient number decoder 1403 to which the bit stream of thenumber of coefficients is inputted decodes this bit stream as the numberof coefficients which has a value other than 0 for each block. In thiscase, the coefficient number decoder 1403 performs decoding by referringto the numbers of coefficients in the decoded blocks stored in thecoefficient number storing unit 1402 with a method which is to beexplained later on. Then, the coefficient value decoder 1404 performsdecoding of the value of the coefficients itself with reference to thecode tables and the VLC tables necessary for variable length decoding byswitching between them using number information of the coefficientgained by the coefficient number decoder 1403. The gained coefficient istransformed into predictive residual picture data by the inversequantizing unit 1405 as well as the inverse orthogonal transforming unit1406.

The motion vectors extracted by the bit stream analyzing unit 1401 areinputted to the inter picture prediction decoder 1408, when a currentmacroblock to be decoded is coded with inter picture prediction. Theinter picture prediction decoder 1408 creates motion compensationpicture data by having decoded picture data of the decoded picturesstored in the frame memory 1407 as reference pictures, based on theinformation on the motion vectors. The motion compensation picture datathus gained is created as decoded picture data by being added to thepredictive residual picture data at the addition calculating unit 1411and then stored in the frame memory 1407.

On the other hand, when the current macroblock is coded using intrapicture prediction, intra picture prediction is performed usinginformation on the adjacent decoded blocks by the intra pictureprediction decoder 1409, and decoded picture data is created and storedin the frame memory 1407. Then, the frame memory 1407 outputs it asdefinitive output picture in display order.

The outline of a flow of decoding has been explained above. Next, adecoding processing of the number of coefficients performed by thecoefficient number decoder 1403 is explained in detail using FIG.18˜FIG. 21.

FIG. 18A is a block diagram showing in detail an internal structure ofthe coefficient number decoder 1403.

Here, an example of using two tables of a VLC table and a code table forperforming variable length decoding of the numbers of coefficients. TheVLC table is a table used for transforming variable length code in a bitstream into a code number whereas the code table is table used fortransforming the code number gained by the VLC table into the number ofcoefficients.

As shown in FIG. 18A, the coefficient number decoder 1403 includes apredictive value calculating unit 1501, a code table storing unit 1502,a code table selecting unit 1503, a VLC table selecting unit 1504, a VLCtable storing unit 1505 and a coefficient number decoder 1506.

Firstly, the numbers of the coefficients in the decoded blocks locatedon the periphery are inputted from the coefficient number storing unit1402 as shown in FIG. 17 to the predictive value calculating unit 1501.The predictive value calculating unit 1501 determines a predictive valueby calculating an average value of these values. A maximum value, aminimum value or a medium value may be used according to the predictivevalue calculating method for coding. The decoded blocks to be thenreferred to are determined following Chart 1 using three blocks in theposition of blocks B, C and D for the current block X shown in FIG. 4A,as in the first embodiment. As for signs in Chart 1, a sign ◯ signifiesa coded block and a sign X signifies a block which can not be referredto since it is either not decoded or situated outside the picture oroutside the slice. Chart 1 shows a relation between conditions of thereference blocks and the block(s) which can be referred to, however, thepatterns are not limited to this. If no reference blocks are found,either a value 0 or other arbitrary value can be given directly as apredictive value.

The code table selecting unit 1503 selects a code table for actual usefrom a plurality of code tables stored in the code table storing unit1502, according to the predictive value calculated by the predictivevalue calculating unit 1501.

Cart 2 is an example of a code table which relates numbers ofcoefficients and code numbers, prepared in advance by the code tablestoring unit 1502. Here, four types of code tables are prepared;however, the numbers of types of tables and the values indicated in thetables are not limited to those used in Chart 2. In this case, however,the same table as the one used for coding shall be used. Also, Chart 3shows selection criteria for code tables based on a predictive value.The way of assigning the predictive value or the items of table is notlimited to those used in Chart 3. However, the same table as the oneused for coding shall be used.

The VLC table selecting unit 1504 selects a VLC table for actual usefrom a plurality of VLC tables stored in the VLC table selecting unit1505 according to the predictive value calculated by the predictivevalue calculating unit 1501.

Chart 4 shows an example of a VLC table which relates number ofcoefficients and code numbers, prepared in advance by the VLC tablestoring unit 1505. Here, four types of VLC tables are prepared, however,the numbers of types of tables and the values indicated in the tablesare not limited to those used in Chart 4. However, in this case, thesame table as the one used for coding shall be used. Also, Chart 5 showsselecting criteria for VLC tables based on a predictive value. The wayof assigning the predictive value and the items indicated in thereference tables are not limited to those used in Chart 5. However, inthis case, it is conditioned to use the same table as the one used forcoding.

The coefficient number decoder 1506 refers to the code table as well asthe VLC table selected in the above processing and performs variablelength decoding for a bit stream of the number of the coefficients inthe inputted current block. The coefficient number decoder 1506 firsttransforms the number of coefficients into a code number using the VLCtable and then transforms it into a value of the number of coefficientscorresponding to the code number using the code table. FIG. 19 is apattern diagram showing an example of decoding when a predictive valuecalculated at the predictive value calculating unit 1501 is “6” and abit stream of the number of coefficients in the current block is “0100”.The predictive value being “6”, the code table selecting unit 1503selects a code table 3 shown in FIG. 19 using Chart 3 and Chart 2, andthe VLC table selecting unit 1504 selects a VLC table 3 shown in FIG. 19using Chart 5 and Chart 4. The coefficient number decoder 1506transforms the inputted bit stream “0100” into a code number “2”according to the VLC table 3 and then determines the definitive numberof coefficients “4” according to the code table.

The following describes in detail storing processing of the number ofcoefficients performed by the coefficient number storing unit 1402, thedetail is explained. FIG. 6A used for the description of the firstembodiment is used here, however, a black boarder containing blockscoded B1˜B16 shows a current macroblock to be decoded whereas hatchedblocks show reference blocks for the current macroblock. The numbers putfor the blocks indicates an order of decoding performed within themacroblock.

The coefficient number storing unit 1402 stores the numbers ofcoefficients decoded by the coefficient number decoder 1403, at leastfor the reference blocks which are hatched as shown in FIG. 6A necessaryfor the current macroblock at the time of starting the processing of thecurrent macroblock shown in FIG. 6A. Namely, the coefficient numberstoring unit 1402 stores the number of the coefficients detected fromthe blocks of the current macroblock (B1, B2, B3, . . . and B16) whichare to be processed sequentially. For example, when a block B6 is acurrent block, the coefficient number storing unit 1402 stores thenumbers of each coefficient of the block B1, B2, B3, B4 and B5 which arealready processed, in addition to those of the reference blocks as shownin FIG. 6A. When the coefficient number decoder 1403 decodes the numberof coefficients of the block B6, the coefficient number storing unit1402 stores it. The coefficient number storing unit 1402 thus stores thenumbers of the coefficients of the blocks in the current macroblock,which are to be processed sequentially.

When a current macroblock is a macroblock MB11 shown in FIG. 2B, thecoefficient number storing unit 1402 at least stores the numbers of thecoefficients of the blocks in the bottom row and in the right column ofthe macroblock MB11 (hatched blocks) in FIG. 7A when the processing ofthis macroblock MB11 terminates and shifts to the next macroblock MB12.Next, the coefficient number storing unit 1402 at least stores thenumbers of the coefficients of the blocks in the bottom row and in theright column of the macroblock MB12 in the same way as well as thenumbers of the coefficients of the blocks in the bottom row of themacroblock MB11 (shaded blocks) as shown in FIG. 7B when the processingof the macroblock MB12 terminates and the processing proceeds to thenext macroblock MB13.

When a current macroblock is located at the right edge of the picture asin a macroblock MB9 shown in FIG. 2B, the coefficient number storingunit 1402 at least stores the numbers of the coefficients of the blocksin the bottom row of the macroblock MB9 when the processing of thismacroblock MB9 terminates and proceeds to the next macroblock MB10.

When a current block is located at the bottom edge of the picture as amacroblock MBm shown in FIG. 2B, the coefficient number storing unit1402 at least stores the numbers of the coefficients of the blocks inthe right column of this macroblock MBm (hatched blocks) as shown inFIG. 7C.

Thus the coefficient number storing unit 1402 at least stores thenumbers of coefficients for the blocks to be referred to. It is possibleto delete, in an arbitrary timing, the information on the numbers ofcoefficients of the blocks other than those to be stored as described inthe above explanation when the blocks are no longer used for reference.For example, it is possible to delete the information when processingproceeds to the next macroblock as well as while processing themacroblock. Also, the numbers of the coefficients of the blocks whichare not used for reference do not always need processing of deleting.For instance, the coefficient number storing unit 1402 may identify thenumbers of coefficients of the blocks which are not referred to anylonger as unnecessary and may overwrite to them if necessary.

It is explained above that it is possible to refer to the numbers of thecoefficients of the decoded blocks by storing them in the coefficientnumber storing unit 1402. However, a system for calculating the numberof coefficients, may be used, if necessary, by storing not the values ofthe number of coefficients themselves but, for instance, the values ofthe coefficients of the blocks, indicating spatial frequency components.

Thus, in the present embodiment, it is possible to calculate thepredictive value using the numbers of coefficients in the decodedadjacent blocks and decode the number of coefficients with reference tothe code table and the VLC table by switching between them adaptivelyaccording to the predictive value.

Also, it handles the changes in a position where the apparitionprobability of the number of coefficients is the highest, with referenceto the code tables by switching them adaptively according to thepredictive value. At the same time, it can correspond to a size of thedispersion of the apparition probability of the number of coefficientswith reference to the VLC tables by switching them according to thepredictive value.

It is possible to use only two blocks in the position of the blocks Band D as the blocks to be referred to by the predictive valuecalculating unit 1501 for the current block X as shown in FIG. 4Binstead of using three neighboring blocks as shown in FIG. 4A. In thiscase, changes in the reference blocks can be made as in Chart 6 when theblocks are either not decoded or located outside the picture or outsidethe slice. As for the signs in Chart 6, a sign ◯ signifies a decodedblock and a sign X signifies a block which can not be referred to sinceit is either not decoded or situated outside the picture or outside theslice, as in Chart 1. Chart 6 shows a relation between conditions of thereference blocks and the block(s) which can be referred to, however, thepatterns are not limited to this. Either a value 0 or other arbitraryvalue is given directly as a predictive value when no reference blocksare found. However, the same value as the one used for coding shall beused. In this case, the coefficient number storing unit 1402 may onlystore the numbers of coefficients decoded by the coefficient numberdecoder 1403, at least those of the reference blocks necessary for thecurrent macroblock, shown in FIG. 6B.

It is also possible, as a method to calculate a predictive value at thepredictive value calculating unit 1501, for example, to select anoptimal method according to each sequence, each GOP, each picture oreach slice rather than to fix the method of using either of an averagevalue, a maximum value, a minimum value or a medium value. In this case,a calculating method is determined by decoding the signals foridentifying a calculation method described in the header section of thesequence or the picture or the slice, of the bit stream. The slice is apicture further divided into a plurality of sections. A sectionequivalent to one column in transverse direction in each macroblock isan example of this.

Also, it is possible to select, for example, either of an average value,a maximum value, a minimum value or a medium value according to theaverage value of the numbers of coefficients in the decoded referenceblocks as a method to calculate a predictive value at the predictivevalue calculating unit 1501. Chart 7 shows the selection criteria. Theway of assigning the average value and the items indicated as predictivevalue calculation methods are not limited to those used in Chart 7. Inthis regard, the same method as the one used for coding shall be used.

The present embodiment shows a decoding processing method of a bitstream in which variable length coding is performed for the values ofthe number of coefficients themselves by the coefficient number decoder1403. It is, however, possible to perform decoding of a bit stream inwhich variable length coding is performed for a difference value betweenthe predictive value and the number of coefficients. In this case, thenumber of coefficients is determined by the fact that the additioncalculating unit 1507 adds the predictive value calculated by thepredictive value calculating unit 1501 to the difference value of thenumber of coefficients decoded by the coefficient number decoder 1506.

Also, the coefficient number decoder 1403 performs variable lengthdecoding by switching both the code table and the VLC table according tothe predictive value based on the numbers of the coefficients of theneighboring blocks. It is, however, possible to fix either of themrather than to switch between them. In this case, this is realized bypreparing a storing unit which has either one certain type of codetables or one certain type of VLC tables. FIG. 20A is a block diagramshowing a structure of the coefficient number decoder 1403 forperforming variable length decoding of the number of coefficients byfixing only the code table. FIG. 20 B is a block diagram showing astructure of the coefficient number decoder 1403 for performing variablelength decoding of the number of coefficients by fixing only the VLCtable. In case of fixing only the code table, the coefficient numberdecoder 1403 as shown in FIG. 20A includes a code table storing unit1601 in stead of the code table storing unit 1502 and the code tableselecting unit 1503 shown in FIG. 18A. The code table storing unit 1601has one certain type of code tables. The coefficient number decoder 1506first transforms variable length code into a code number using the VLCtable selected by the VLC table selecting unit 1504 and then transformsthe code number into the number of coefficients using the code tablestored in the code table storing unit 1601.

On the other hand, in case of fixing only the VLC table, the coefficientnumber decoder 1403 as shown in FIG. 20B includes a VLC table storingunit 1602 in stead of the VLC table storing unit 1505 and the VLC tableselecting unit 1504 shown in FIG. 18A. The VLC table storing unit 1602has one certain type of VLC table. The coefficient number decoder 1506firstly transforms a variable length code into a code number using theVLC table stored in the VLC table storing unit 1602 and then transformsthe code number into the number of coefficients using the code tableselected by the code table selecting unit 1503.

Thus it is possible to reduce memory capacity for storing a plurality oftables by fixing either of a code table and a VLC table.

It is also possible to perform variable length decoding in thecoefficient number decoder 1403 by switching only the VLC tables withoutusing code tables, according to the predictive value based on thenumbers of the coefficients of the neighboring blocks. FIG. 20C is ablock diagram showing a structure of the coefficient number decoder 1403when performing variable length decoding of the coefficient number usingonly a VLC table without using code tables. In this case, as shown inFIG. 20C, the coefficient number decoder 1403 includes neither the codetable storing unit 1502 nor the code table selecting unit 1503 shown inFIG. 18A. In the coefficient number decoder 1403, the VLC tableselecting unit 1603 selects the VLC table for actual use from aplurality of VLC tables stored in the VLC table storing unit 1604, basedon the predictive value calculated by the predictive value calculatingunit 1501. Then, the coefficient number decoder 1506 transforms directlya variable length code into the number of coefficients withouttransforming the number of coefficients into a code number using thecode table as described above.

Thus by fixing either of the code table or the VLC table in stead ofswitching between them, the throughput for switching tables can bereduced or an amount of memory for storing a plurality of tables can bereduced although the effects of coding efficiency decreases more orless.

Also, a case in which the coefficient number decoder 1403 decodes a bitstream in which variable length coding is performed to the differencevalue between the predictive value and the number of coefficients, instead of the value of the number of coefficients, can be handled in thesame way. FIG. 21 is a block diagram of its example showing a structureof the coefficient number decoder 1403 for performing decoding of thebit stream in which variable length decoding is performed to thedifference value between the predictive value and the number ofcoefficients by fixing both the code table and the VLC table. In thiscase, as shown in FIG. 21, the coefficient number decoder 1403 includesa code table storing unit 1601 in stead of the code table storing unit1502 and the code table selecting unit 1503 shown in FIG. 18A as well asa VLC table storing unit 1602 in stead of the VLC table storing unit1505 and the VLC table selecting unit 1504 shown in FIG. 18A. This codetable storing unit 1601 has one certain type of code tables whereas theVLC table storing unit 1602 has one certain type of VLC table. Thecoefficient number decoder 1506 first transforms a variable length codeinto a code number using the VLC table stored in the VLC table storingunit 1602 and then transforms the code number into a difference valuebetween the predictive value and the number of coefficients using thecode table stored in the code table storing unit 1601. The additioncalculating unit 1507 calculates the number of coefficients by addingthe difference value to the predictive value.

Seventh Embodiment

The structure of the picture decoding device and the outline of thedecoding processing are totally the same as in the sixth embodiment,apart from the coefficient number decoder 1403 shown in FIG. 17. As fora variable length decoding processing of the number of coefficientsperformed at the coefficient number decoder 1403 according to theseventh embodiment, the detail is explained here using FIGS. 11 and 22.The bit stream created at the picture coding device according to thesecond embodiment shall be inputted.

FIG. 22A is a block diagram showing in detail an internal structure ofthe coefficient number decoder 1403.

As shown in FIG. 22A, the coefficient number decoder 1403 includes acode table generating unit 1901 in stead of the code table storing unit1502 and the code table selecting unit 1503 shown in FIG. 18A. Thenumbers of coefficients in the decoded blocks are inputted from thecoefficient number storing unit 1402 shown in FIG. 17 to the code tablegenerating unit 1901. The code table generating unit 1901 counts thenumber of the decoded blocks having the same number of coefficients asthe value of the number of coefficients at each value of the number ofcoefficients and creates code tables by assigning code numbers indescending order starting from a number of coefficients which recordedthe highest frequency based on the statistic. FIG. 11A is a patterndiagram presenting a position of decoded blocks targeted for statistics.Here, a P1, a P3 and a P4 are pictures in which inter picture predictionis performed whereas an I2 is a picture in which intra pictureprediction is performed. Supposing that a current block to be decodedbelongs to the P3, all the blocks in the P1, a picture immediatelypreceding the current picture decoded with the same method, are targetedfor statistics. The case in which the blocks equivalent to one pictureincluding the decoded blocks in the current picture are targeted forstatistics can be handled in the same way. Also, a table for the initialcondition in ascending order starting from the value 0 is used when thedecoded blocks equivalent to one picture which can be targeted forstatistics do not exist. Here, the blocks equivalent to one picture aretargeted for statistics, however, the case in which the number of blocksother than this is used as a parameter can be handled in the same way.In this regard, the same number as the one used for coding shall beused. In the case of generating the code table as described above bymaking reference as shown in FIG. 11A, the table may be generated onlyonce when encoding of the current picture is started.

Meanwhile, the numbers of coefficients in the decoded blocks located onthe periphery are inputted to the predictive value calculating unit1501. The predictive value calculating unit 1501 determines thepredictive value by calculating an average value based on these valuesas in the sixth embodiment. A maximum value, a minimum value or a mediumvalue may be used in stead of the average value as a method to determinethe predictive value. As in the sixth embodiment, the decoded blocksthen used as reference, are determined using the three blocks located inthe position of the blocks B, C and D for the current block X shown inFIG. 4A according to Chart 1. Chart 1 shows a relation betweenconditions of the reference blocks and the block(s) which can bereferred to, however, the patterns are not limited to this. Either avalue 0 or other arbitrary value is given directly as a predictive valuewhen no reference blocks are found. In this regard, the same value asthe one used for coding shall be used.

The predictive value calculated by the predictive value calculating unit1501 is used only in the VLC table selecting unit 1504. The VLC tableselecting unit 1504 selects, as in the sixth embodiment, a VLC table fordecoding the number of coefficients from a plurality of VLC tablesprepared beforehand in the VLC table storing unit 1505 as shown in Chart4, according to the selection criteria shown in Chart 5.

The coefficient number decoder 1506 refers to the code table created bythe code table generating unit 1901 and the VLC table selected by theVLC table selecting unit 1504 and performs variable length decoding forthe bit stream of the number of coefficients inputted in the same way asin the sixth embodiment.

Thus, in the present embodiment, it is possible to create a code tableby taking statistics of the numbers of coefficients in the decodedblocks and determine a VLC table according to the predictive valuecalculated using the numbers of the coefficients in the decoded blocksand perform the decoding of the number of coefficients by referring toboth of the tables.

It is also possible to determine the decoded blocks to be used forreference at the predictive value calculating unit 1501 as in the sixthembodiment according to Chart 6, using only two blocks located in theposition of the blocks B and D with respect to the current block X shownin FIG. 4B, in stead of using three adjacent blocks as shown in FIG. 4A.Chart 6 shows a relation between conditions of the reference blocks andthe block(s) which can be referred to, however, the patterns are notlimited to this. Either a value 0 or other arbitrary value is givendirectly as a predictive value when no reference blocks are found. Inthis regard, the same value as the one used for coding shall be used.

It is also possible, as a method to calculate a predictive value at thepredictive value calculating unit 1501, for example, to select anoptimal method according to each sequence, each GOP, each picture oreach slice rather than to fix the method to use either of an averagevalue, a maximum value, a minimum value or a medium value. In this case,the calculation method is determined by decoding the signals foridentifying the calculating method described in the header of thesequence, the GOP or the picture or the slice, of the bit stream.

Also, it is possible to select, for example, either of an average value,a maximum value, a minimum value or a medium value according to theaverage value of the numbers of coefficients in the decoded referenceblocks as a method to calculate a predictive value at the predictivevalue calculating unit 1501. Chart 7 shows its selection criteria. Theway of assigning the average value and the items indicated as predictivevalue calculation methods are not limited to those used in Chart 7. Inthis regard, the same method as the one used for coding shall be used.

Also, the present embodiment shows a decoding processing method of a bitstream in which variable length coding is performed to the values of thenumber of coefficients themselves. It is, however, possible to performdecoding of a bit stream in which variable length coding is performed toa difference value between a predictive value and the number ofcoefficients. In this case, the number of coefficients is determined bythe fact that the addition calculating unit 1507 adds the differencevalue between the predictive value calculated at the predictive valuecalculating unit 1501 as shown in FIG. 22 to the number of coefficientsdecoded by the coefficient number decoder 1506.

Also, in the above-mentioned embodiment, the coefficient number decoder1403 performs variable length decoding by switching the VLC tablesaccording to the predictive value based on the numbers of thecoefficients in the adjacent blocks. It is, however, possible to fix thetable rather than to switch between the tables as in the sixthembodiment. In this case, this is realized by using only a VLC tablestoring unit which has one certain type of VLC tables, in stead of usingthe VLC table selecting unit.

Eighth Embodiment

The structure of the picture decoding device and the outline of thedecoding processing are totally the same as in the sixth embodiment,apart from the coefficient number decoder 1403 shown in FIG. 17. As forvariable length decoding processing of the number of coefficientsperformed by the coefficient number decoder 1403 according to the eighthembodiment, the detail is explained here using FIG. 23, Chart 8 andChart 9. The bit stream created by the picture coding device accordingto the third embodiment shall be inputted.

FIG. 23A is a block diagram showing in detail an internal structure ofthe coefficient number decoder 1403.

As shown in FIG. 23A, the coefficient number decoder 1403 does notinclude the predictive value calculating unit 1501 shown in FIG. 18A. Acode table selecting unit 2001 and a VLC table selecting unit 2002select a table for actual use by using directly the numbers ofcoefficients in the decoded blocks without using a predictive value,which is different from the sixth embodiment. As for the decoded blocksthen used for the reference shown in FIG. 4B, only two blocks in theposition of the block B (above) and the block D (left) with respect tothe current block X are used. However, when the blocks located above andon the left are neither decoded nor situated outside the picture noroutside the slice, either a value 0 or other arbitrary value can besubstituted. In this regard, the same value as the one used for codingshall be used.

Chart 8 shows a selection method for code tables at the code tableselecting unit 2001. The code table selecting unit 2001 classifies intotwo groups the respective numbers of coefficients in the blocks situatedabove and on the left of the current block, as shown in Chart 8,according to the value, and selects a table using a combination of thefour thus formed. The method to classify the number of coefficients inthe upper and the left blocks and the way to assign the code tables arenot limited to those used in Chart 8. In this regard, the same method asthe one used for coding is used in this case. Also, the VLC tableselecting unit 2002 selects a VLC table for actual reference using theselection method shown in Chart 9, as in the case of the code tableselecting unit 2001.

The coefficient number decoder 1506 refers to the code table selected bythe code table selecting unit 2001 and the VLC table selected by the VLCtable selecting unit 2002 and performs variable length decoding for thenumber of coefficients in the current block which is inputted in thesame way as in the sixth embodiment.

The present embodiment as shown above, by classifying the number ofcoefficients in the decoded blocks located above and on the left of thecurrent block into “N” group(s) according to the value with reference tothe code table and the VLC table, according to the combination of N×Nways then formed, and by switching between them adaptively, it ispossible to perform efficiently the decoding of the number ofcoefficients.

The present embodiment shows a decoding processing method of a bitstream in which variable length coding is performed to the values of thenumber of coefficients themselves. It is, however, possible to performdecoding of a bit stream in which variable length coding is performed toa difference value between the predictive value and the number ofcoefficients. In this case, the number of coefficients is determined bythe fact that the addition calculating unit 1507 adds the differencevalue between the predictive value calculated at the predictive valuecalculating unit 1501 to the number of coefficients decoded by thecoefficient number decoder 1506.

Also, the coefficient number decoder 1403 performs variable lengthdecoding by switching both the code table and the VLC table according tothe numbers of coefficients in the neighboring blocks. It is, however,possible to fix either of these tables rather than to switch betweenthem as in the sixth embodiment. In this case, this is realized by usinga storing unit which has either one certain type of code tables or onecertain type of VLC tables, in stead of using the table selecting units.Furthermore, it is possible to perform variable length decoding byswitching only the VLC tables without using code tables according to thenumbers of coefficients in the adjacent blocks, as in the sixthembodiment.

Ninth Embodiment

The structure of the picture decoding device and the outline of thedecoding processing according to the present embodiment are totally thesame as the sixth embodiment apart from the coefficient number decoder1403 shown in FIG. 17. Regarding variable length decoding processing ofthe number of coefficients performed by the coefficient number decoder1403 according to the ninth embodiment, the detail is explained hereusing FIGS. 24 and 14. The bit stream created by the picture codingdevice according to the fourth embodiment shall be inputted.

FIG. 24A is a block diagram showing in detail an internal structure ofthe coefficient number decoder 1403.

As shown in FIG. 24A, the coefficient number decoder 1403 includes atable selecting unit 2101 instead of the predictive value calculatingunit 1501, the code table selecting unit 1503 and the VLC tableselecting unit 1504 shown in FIG. 18A. The table selecting unit 2101uses directly the number of the coefficients in the decoded blockswithout using a predictive value and selects a table for actual use byevaluating both the code table and the VLC table at the same time, whichis different from the sixth embodiment. As for the decoded blocks thenused for the reference, the three blocks in the position of the blocksB, C and D with respect to the current block X are used as in FIG. 4A.In this regard, when the blocks thus located are neither decoded norsituated outside the picture nor outside the slice, either a value 0 orother arbitrary value is substituted as the number of coefficients.However, the same value as the one used for coding shall be used.

As shown in FIG. 14, the table selecting unit 2101 calculates a sum of alength of a bit stream which is created as a result of coding thenumbers of the coefficients in the reference blocks using both the codetable and the VLC table at the same time and determines it as anevaluation value as in the fourth embodiment. Then, the table selectingunit 2101 performs this processing for all the combinations of the codetable and the VLC table stored in the code table storing unit 1502 aswell as the VLC table storing unit 1505 and selects a combination of acode table and a VLC table in which the gained evaluation value is thesmallest.

The coefficient number decoder 1506 refers to the code table and the VLCtable selected by the table selecting unit 2101 and performs variablelength coding for the number of the coefficients in the current blockwhich is inputted in the same way as in the sixth embodiment.

Thus, in the present embodiment, the coding is performed for the numbersof coefficients in the neighboring blocks which are decoded using thecode table and the VLC table, an estimation value is determined usingthe sum of the length of the bit stream at that time and decoding isperformed for the number of coefficients by referring to the code tableand the VLC table whose combination generates the smallest evaluationvalue.

As for the decoded blocks used for reference by the table selecting unit2101, a case of using only two blocks located in the position of theblocks B and D with respect to the current block X as shown in FIG. 4Bin stead of using three neighboring blocks shown in FIG. 4A, can behandled in the same way as in the sixth embodiment. In this regard, whenthe blocks thus located are neither decoded nor situated outside thepicture nor outside the slice, either a value 0 or other arbitrary valuecan be substituted as a number of coefficients.

Also, the present embodiment shows a decoding processing method of a bitstream in which variable length coding is performed for the values ofthe number of coefficients themselves. It is, however, possible toperform decoding of a bit stream in which variable length coding isperformed for a difference value between the predictive value and thenumber of coefficients. In this case, the number of coefficients isdetermined by the fact that the addition calculating unit 1507 adds thedifference value between the predictive value calculated by thepredictive value calculating unit 1501 to the number of coefficientsdecoded by the coefficient number decoder 1506, as shown in FIG. 24B.

Also, in the present embodiment, the code table and the VLC table aretargeted for switching in the coefficient number decoder 1403, however,it is possible to fix either of them rather than to switch between them.

Tenth Embodiment

The structure of the picture decoding device and the outline of thedecoding processing according to the present embodiment are totally thesame as in the sixth embodiment, apart from the coefficient numberdecoder 1403 shown in FIG. 17. The present embodiment uses an interpicture prediction mode for inter picture prediction decoding and anintra picture prediction mode for intra picture prediction decoding asreferring information at the coefficient number decoder 1403 in stead ofthe numbers of coefficients in the decoded blocks as in the sixthembodiment. The bit stream which is created at the picture coding deviceaccording to the fifth embodiment shall be inputted.

Here, regarding variable length decoding processing of the number ofcoefficients performed by the coefficient number decoder 1403 shown inFIG. 17, the detail is explained with reference to FIG. 25.

FIG. 25 is a block diagram showing in detail an internal structure ofthe coefficient number decoder 1403.

As shown in FIG. 25, the coefficient number decoder 1403 does notinclude the predictive value calculating unit 1501 shown in FIG. 18A.The inter picture prediction mode for inter picture prediction decodingand the intra picture prediction mode for intra picture predictiondecoding are Inputted from the bit stream analyzing unit 1401 to a codetable selecting unit 2201 as well as a VLC table selecting unit 2202.The code table selecting unit 2201 selects a table to be used based onthe mode: the inter picture prediction mode for inter picture predictiondecoding and the intra picture prediction mode for intra pictureprediction decoding. Chart 10 shows a selection method for the codetables stored in the code table selecting unit 2201.

For example, in case where the current picture is decoded using interpicture prediction, a code table 2 is selected accordingly for variablelength decoding of the number of coefficients when the size of thecurrent block 8×8 is selected for prediction. The items are not limitedto those used in Chart 10. In this regard, the same items as the onesused for coding shall be used.

Also, the VLC table selecting unit 2202 selects a VLC table for actualreference using the selection method as shown in Chart 11 as in the caseof the code table selecting unit 2201.

The coefficient number decoder 1506 refers to the code table selected bythe code table selecting unit 2201 as well as to the VLC table selectedby the VLC table selecting unit 2202 so as to perform variable lengthdecoding of the number of the coefficients in the current block which isinputted in the same way as in the sixth embodiment.

Thus in the present embodiment can perform decoding of the number ofcoefficients by referring to the code table and the VLC table inswitching between them adaptively according to the mode: the interpicture prediction mode for inter picture prediction decoding and theintra picture prediction mode for intra picture prediction decoding.

The present embodiment shows a decoding processing method of a bitstream in which variable length coding is performed to the values of thenumber of coefficients themselves. It is, however, possible to performdecoding of a bit stream in which variable length coding is performed toa difference value between a predictive value and a number ofcoefficients. In this case, the predictive value is determined by usingthe numbers of the coefficients in the adjacent decoded blocks and thenumber of coefficients is determined by adding this value to thedifference value of the number of coefficients, which is decoded by thecoefficient number decoder 1506, as in the sixth embodiment.

Also, in the present embodiment, the coefficient number decoder 1403performs variable length decoding by switching both of the code tableand the VLC table. It is, however, possible to fix them rather thanswitching either or both of them. In this case, this is realized bypreparing only a storing unit which has either one certain type of codetables or one certain type of VLC tables.

Eleventh Embodiment

If a program for realizing the structure of the coding method or thedecoding method as shown in the above-mentioned embodiments is recordedon a memory medium such as a flexible disk, it becomes possible toperform the processing as shown in these embodiments easily in anindependent computer system.

FIGS. 26A, 26B and 26C are illustrations showing the case where theprocessing shown in the 1˜10 above-mentioned embodiments is performed ina computer system using a flexible disk which stores the coding methodor the decoding method of the above-mentioned embodiments.

FIG. 26B shows a full appearance of a flexible disk, its structure atcross section and the flexible disk itself whereas FIG. 26A shows anexample of a physical format of the flexible disk as a main body of arecording medium. A flexible disk FD is contained in a case F, aplurality of tracks Tr are formed concentrically from the periphery tothe inside on the surface of the disk, and each track is divided into 16sectors Se in the angular direction. Therefore, the flexible diskstoring the above-mentioned program stores the data as theaforementioned program in an area assigned for it on the flexible diskFD.

FIG. 26C shows a structure for recording and reading out the program onthe flexible disk FD. When the program is recorded on the flexible diskFD The computer system Cs writes in the data as the program via aflexible disk drive. When the coding device and the decoding device areconstructed in the computer system by the program on the flexible disk,the program is read out from the flexible disk by the flexible diskdrive and then transferred to the computer system.

The above explanation is made on an assumption that a flexible disk isused as a data recording medium, but the same processing can also beperformed using an optical disk. In addition, the recording medium isnot limited to a flexible disk and an optical disk, but any other mediumsuch as an IC card and a ROM cassette capable of recording a program canbe used.

Following is an explanation of the applications of the picture codingmethod as well as the picture decoding method as shown in theabove-mentioned embodiments, and a system using them.

FIG. 27 is a block diagram showing an overall configuration of a contentsupply system ex100 for realizing content distribution service. The areafor providing communication service is divided into cells of desiredsize, and cell sites ex107˜ex110 which are fixed wireless stationsplaced in respective cells.

This content supply system ex100 is connected to devices such as acomputer ex111, a PDA (Personal Digital Assistant) ex112, a cameraex113, a cell phone ex114 and a cell phone with a camera ex115 via theInternet ex101, an Internet service provider ex102, a telephone networkex104 and cell sites ex107˜ex110.

However, the content supply system ex100 is not limited to theconfiguration as shown in FIG. 27 and may be connected to a combinationof any of them. Also, each device may be connected directly to thetelephone network ex104 not through the cell sites ex107˜ex110.

The camera ex113 is a device capable of shooting video such as a digitalvideo camera. The cell phone ex114 may be a cell phone of a PDC(Personal Digital Communications) system, a CDMA (Code Division MultipleAccess) system, a W-CDMA (Wideband-Code Division Multiple Access) systemor a GSM (Global System for Mobile Communications) system, a PHS(Personal Handyphone System) or the like.

A streaming server ex103 is connected to the camera ex113 via thetelephone network ex104 and the cell site ex109, which realizes a livedistribution or the like using the camera ex113 based on the coded datatransmitted from the user. Either the camera ex113 or the server whichtransmits the data may code the data. Also, the picture data shot by acamera ex116 may be transmitted to the streaming server ex103 via thecomputer ex111. In this case, either the camera ex116 or the computerex111 may code the picture data. An LSI ex117 included in the computerex111 or the camera ex116 actually performs coding processing. Softwarefor coding and decoding pictures may be integrated into any type ofstorage medium (such as a CD-ROM, a flexible disk and a hard disk) thatis a recording medium which is readable by the computer ex111 or thelike. Furthermore, a cell phone with a camera ex115 may transmit thepicture data. This picture data is the data coded by the LSI included inthe cell phone ex115.

The content supply system ex100 codes contents (such as a music livevideo) shot by users using the camera ex113, the camera ex116 or thelike in the same way as shown in the above-mentioned embodiments andtransmits them to the streaming server ex103, while the streaming serverex103 makes stream distribution of the content data to the clients attheir requests. The clients include the computer ex111, the PDA ex112,the camera ex113, the cell phone ex114 and so on capable of decoding theabove-mentioned coded data. In the content supply system ex100, theclients can thus receive and reproduce the coded data, and can furtherreceive, decode and reproduce the data in real time so as to realizepersonal broadcasting.

When each device in this system performs coding or decoding, the picturecoding device or the picture decoding device, as shown in theabove-mentioned embodiments, can be used.

A cell phone will be explained as an example of the device.

FIG. 28 is a diagram showing the cell phone ex115 using the picturecoding method and the picture decoding method explained in theabove-mentioned embodiments. The cell phone ex115 has an antenna ex201for communicating with the cell site ex110 via radio waves, a cameraunit ex203 such as a CCD camera capable of shooting moving and stillpictures, a display unit ex202 such as a liquid crystal display fordisplaying the data such as decoded pictures and the like shot by thecamera unit ex203 and received by the antenna ex201, a body unitincluding a set of operation keys ex204, a voice output unit ex208 suchas a speaker for outputting voices, a voice input unit 205 such as amicrophone for inputting voices, a storage medium ex207 for storingcoded or decoded data such as data of moving or still pictures shot bythe camera, data of received e-mails and data of moving or stillpictures, and a slot unit ex206 for attaching the storage medium ex207to the cell phone ex115. The storage medium ex207 stores in itself aflash memory element, a kind of EEPROM (Electrically Erasable andProgrammable Read Only Memory) that is a nonvolatile memory electricallyerasable from and rewritable to a plastic case such as a SD card.

Next, the cell phone ex115 will be explained with reference to FIG. 29.In the cell phone ex115, a main control unit ex311, designed in order tocontrol overall each unit of the main body which contains the displayunit ex202 as well as the operation keys ex204, is connected mutually toa power supply circuit unit ex310, an operation input control unitex304, a picture coding unit ex312, a camera interface unit ex303, anLCD (Liquid Crystal Display) control unit ex302, a picture decoding unitex309, a multiplexing/demultiplexing unit ex308, a read/write unitex307, a modem circuit unit ex306 and a voice processing unit ex305 viaa synchronous bus ex313.

When a call-end key or a power key is turned ON by a user's operation,the power supply circuit unit ex310 supplies respective units with powerfrom a battery pack so as to activate the camera attached digital cellphone ex115 as a ready state.

In the cell phone ex115, the voice processing unit ex305 converts thevoice signals received by the voice input unit ex205 in conversationmode into digital voice data under the control of the main control unitex311 including a CPU, ROM and RAM, the modem circuit unit ex306performs spread spectrum processing of the digital voice data, and thecommunication circuit unit ex301 performs digital-to-analog conversionand frequency transformation of the data, so as to transmit it via theantenna ex201. Also, in the cell phone ex115, the communication circuitunit ex301 amplifies the data received by the antenna ex201 inconversation mode and performs frequency transformation andanalog-to-digital conversion to the data, the modem circuit unit ex306performs inverse spread spectrum processing of the data, and the voiceprocessing unit ex305 converts it into analog voice data, so as tooutput it via the voice output unit 208.

Furthermore, when transmitting an e-mail in data communication mode, thetext data of the e-mail inputted by operating the operation keys ex204of the main body is sent out to the main control unit ex311 via theoperation input control unit ex304. In the main control unit ex311,after the modem circuit unit ex306 performs spread spectrum processingof the text data and the communication circuit unit ex301 performsdigital-to-analog conversion and frequency transformation to it, thedata is transmitted to the cell site ex110 via the antenna ex201.

When picture data is transmitted in data communication mode, the picturedata shot by the camera unit ex203 is supplied to the picture codingunit ex312 via the camera interface unit ex303. When it is nottransmitted, it is also possible to display the picture data shot by thecamera unit ex203 directly on the display unit 202 via the camerainterface unit ex303 and the LCD control unit ex302.

The picture coding unit ex312, which includes the picture coding deviceas explained in the present invention, compresses and codes the picturedata supplied from the camera unit ex203 by the coding method used forthe picture coding device as shown in the above-mentioned firstembodiment so as to transform it into coded picture data, and sends itout to the multiplexing/demultiplexing unit ex308. At this time, thecell phone ex115 sends out the voices received by the voice input unitex205 during the shooting with the camera unit ex203 to themultiplexing/demultiplexing unit ex308 as digital voice data via thevoice processing unit ex305.

The multiplexing/demultiplexing unit ex308 multiplexes the coded picturedata supplied from the picture coding unit ex312 and the voice datasupplied from the voice processing unit ex305 using a predeterminedmethod, the modem circuit unit ex306 performs spread spectrum processingof the multiplexed data obtained as a result of the multiplexing, andthe communication circuit unit ex301 performs digital-to-analogconversion and frequency transformation of the data for the transmissionvia the antenna ex201.

As for receiving data of a moving picture file which is linked to a Webpage or the like in data communication mode, the modem circuit unitex306 performs inverse spread spectrum processing of the data receivedfrom the cell site ex110 via the antenna ex201, and sends out themultiplexed data obtained as a result of the processing to themultiplexing/demultiplexing unit ex308.

In order to decode the multiplexed data received via the antenna ex201,the multiplexing/demultiplexing unit ex308 separates the multiplexeddata into a bit stream of picture data and a bit stream of voice data,and supplies the coded picture data to the picture decoding unit ex309and the voice data to the voice processing unit ex305 respectively viathe synchronous bus ex313.

Next, the picture decoding unit ex309, which includes the picturedecoding device as explained in the above-mentioned invention, decodesthe bit stream of picture data by the decoding method corresponding tothe coding method as shown in the above-mentioned embodiments togenerate reproduced moving picture data, and supplies this data to thedisplay unit ex202 via the LCD control unit ex302, and thus picture dataincluded in a moving picture file linked to a Web page, for instance, isdisplayed. At the same time, the voice processing unit ex305 convertsthe voice data into analog voice data, and supplies this data to thevoice output unit ex208, and thus voice data included in the movingpicture file linked to a Web page, for instance, is reproduced.

The present invention is not limited to the above-mentioned system, andeither the picture coding device or the picture decoding device in theabove-mentioned embodiments can be incorporated into a digitalbroadcasting system as shown in FIG. 30. Such ground-based or satellitedigital broadcasting has been in the news lately. More specifically, abit stream of video information is transmitted from a broadcast stationex409 to or communicated with a broadcast satellite ex410 via radiowaves. Upon receipt of it, the broadcast satellite ex410 transmits radiowaves for broadcasting. Then, a home-use antenna ex406 with a satellitebroadcast reception function receives the radio waves, and a television(receiver) ex401 or a set top box (STB) ex407 decodes the bit stream forreproduction. The picture decoding device as shown in theabove-mentioned embodiment can be implemented in the reproducing deviceex403 for reading out and decoding the bit stream recorded on a storagemedium ex402 that is a recording medium such as a CD and a DVD. In thiscase, the reproduced video signals are displayed on a monitor ex404. Itis also conceivable to implement the picture decoding device in the settop box ex407 connected to a cable ex405 for a cable television or theantenna ex406 for satellite and/or ground-based broadcasting so as toreproduce them on a monitor ex408 of the television ex401. The picturedecoding device may be incorporated into the television, not in the settop box. Also, a car ex412 having an antenna ex411 can receive signalsfrom the satellite ex410 or the cell site ex107 for reproducing movingpictures on a display device such as a car navigation system ex413.

Furthermore, the picture coding device as shown in the above-mentionedembodiments can code picture signals for recording on a recordingmedium. As a concrete example, there is a recorder ex420 such as a DVDrecorder for recording picture signals on a DVD disk ex421 and a diskrecorder for recording them on a hard disk. They can be recorded on anSD card ex422. If the recorder ex420 includes the picture decodingdevice as shown in the above-mentioned embodiments, the picture signalsrecorded on the DVD disk ex421 or the SD card ex422 can be reproducedfor display on the monitor ex408.

As for the structure of the car navigation system ex413, the structurewithout the camera unit ex203, the camera interface unit ex303 and thepicture coding unit ex312, out of the components shown in FIG. 29, isconceivable. The same goes for the computer ex111, the television(receiver) ex401 and others.

In addition, three types of implementations can be conceived for aterminal such as the above-mentioned cell phone ex114; asending/receiving terminal implemented with both an encoder and adecoder, a sending terminal implemented with an encoder only, and areceiving terminal implemented with a decoder only.

As described above, it is possible to use the picture coding method orthe picture decoding method in the above-mentioned embodiments for anyof the above-mentioned devices and systems, and by using this method,the effects described in the above-mentioned embodiments can beobtained.

Also, the present invention is not limited to the above-mentionedembodiments and a wide range of variations or modifications within thescope of the following claims are possible.

A picture coding method according to the present invention improvescoding efficiency since optimal tables for variable length coding can bereferred to when the number of coefficients other than 0 contained in acurrent block to be coded is encoded.

Also, a picture decoding method according to the present inventiondecodes correctly a bit stream in which a number of coefficients otherthan 0 contained in a block after orthogonal transformation is codedwith reference to optimal tables for variable length coding.

INDUSTRIAL APPLICABILITY

Thus, the picture coding method and the picture decoding methodaccording to the present invention are useful as a method to encode animage so as to create a bit stream as well as to decode the created bitstream using devices such as a cell phone, a DVD device, a personalcomputer or the like.

1-33. (canceled)
 34. A coding method for coding an image on a blockbasis, the method comprising: determining a predictive value for a totalnumber of non-zero coefficients included in a current block to be codedbased on a total number of non-zero coefficients included in a codedblock located above the current block and a total number of non-zerocoefficients included in a coded block located to the left of thecurrent block, wherein each non-zero coefficient is a transformcoefficient having a level value other than “0”; selecting a variablelength code table based on the determined predictive value; and codingthe total number of non-zero coefficients included in the current blockby using the selected variable length code table, wherein the predictivevalue is determined based on the total number of non-zero coefficientsincluded in the coded block located to the left of the current blockwhen an upper boundary of the current block is either a boundary of apicture or a boundary of a slice which is one of a plurality of sectionsinto which the picture is divided, and a left boundary of the currentblock is neither the boundary of the picture nor the boundary of theslice, and the predictive value is determined based on the total numberof non-zero coefficients included in the coded block above the currentblock when a left boundary of the current block is either a boundary ofa picture or a boundary of a slice which is one of a plurality ofsections into which the picture is divided, and an upper boundary of thecurrent block is neither the boundary of the picture nor the boundary ofthe slice.
 35. A coding method for coding an image on a block basis, themethod comprising: determining a predictive value for a total number ofnon-zero coefficients included in a current block to be coded based on atotal number of non-zero coefficients included in a coded block locatedabove the current block and a total number of non-zero coefficientsincluded in a coded block located to the left of the current block,wherein each non-zero coefficient is a transform coefficient having alevel value other than “0”; selecting a variable length code table basedon the determined predictive value; and coding the total number ofnon-zero coefficients included in the current block by using theselected variable length code table, wherein, in a case of when one ofthe two coded blocks located above and to the left of the current blockis located outside a picture or a slice including the current block, thepredictive value is determined based on the total number of non-zerocoefficients included in the other of the two coded blocks.